Skip to content

Instantly share code, notes, and snippets.

@aruld
Created March 21, 2015 07:36
Show Gist options
  • Save aruld/9d21eb152f75493206db to your computer and use it in GitHub Desktop.
Save aruld/9d21eb152f75493206db to your computer and use it in GitHub Desktop.
cannot reduce visibility of private methods
public class VisibilityTest {
interface I {
private void foo(int x) {}
private void bar(int x) {}
}
interface J extends I {
void foo(int x); // Valid: public abstract method with the same signature as a private method in super type is allowed.
default void bar(int x) {} // Valid: public default method with the same signature as a private method in super type is allowed.
}
interface K extends J {
private void foo(int x) {} // Invalid: attempting to assign weaker access privileges
private void bar(int x) {} // Invalid: attempting to assign weaker access privileges
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment