I would like to design class A implements interface C and reduce the visibility of a method (declared in C)to make it secure from outer world, make one of the methods in in
This approach worked for me. Any new function added to PrivateInterface would break still break PublicSampleClass
private interface PrivateInterface {
void fooBar();
}
public class PublicSampleClass {
private final listenerInterface = new PrivateInterface {
public void fooBar() {
PublicSampleClass.this.fooBar();
}
};
protected void fooBar() {
// Non public implementation
}
}