Interface private & "default" added by javac
Ionut
ionutb83 at yahoo.com
Sat Apr 14 12:03:21 UTC 2018
Hello All,
I have an initial interface containing one default and one private method:
public interface InterfacePrivateMethod {
default void foo(){
print();
}
private void print() {
System.out.println("Private Method");
}
}
After I compile it with javac and then decompile, the class I get looks like:
public interface InterfacePrivateMethod {
default void foo() {
this.print();
}
private default void print() { // private default !?
System.out.println("Private Method");
}
}
Basically javac inserts default in the private method signature.
Could you please provide more details about this, why is that? At the Java source code level a private method cannot be default in the same time inside an Interface.
Thanks a lot,Ionut
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20180414/0c2f631c/attachment.html>
More information about the hotspot-compiler-dev
mailing list