Last active
December 21, 2015 12:08
-
-
Save vaskoz/6303295 to your computer and use it in GitHub Desktop.
JSR-335 4 bytecode updates: invokeinterface, invokespecial, invokestatic, and invokevirtual
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface I { | |
default String hi() { return "hello"; } | |
static String here() { return "i'm static"; } | |
// NEXT LINE WILL NOT COMPILE. But JLS8 says private default methods are allowed. | |
default private String you() { return "yoho"; } // Not implemented as of jdk8b103. | |
} | |
class C implements I { | |
} | |
public class Jvm8Changes { | |
public static void main(String[] args) { | |
C c = new C(); | |
I i = c; | |
i.hi(); // invokeinterface | |
I.here(); // invokestatic | |
c.hi(); // invokevirtual | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment