Skip to content

Instantly share code, notes, and snippets.

@vaskoz
Last active December 21, 2015 12:08
Show Gist options
  • Save vaskoz/6303295 to your computer and use it in GitHub Desktop.
Save vaskoz/6303295 to your computer and use it in GitHub Desktop.
JSR-335 4 bytecode updates: invokeinterface, invokespecial, invokestatic, and invokevirtual
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