b130 MethodHandle weirdness?
Ben Evans
benjamin.john.evans at gmail.com
Mon Feb 21 10:55:58 PST 2011
Hi,
I've noticed some oddities with b130 MethodHandles (this is x64 Ubuntu):
private void foo() {
System.out.println("Foo!");
}
private void run(String[] args) {
MethodHandle mh;
MethodType desc = MethodType.methodType(void.class);
try {
mh = MethodHandles.lookup().findVirtual(getClass(), "foo",
desc);
} catch (NoAccessException e) {
throw (AssertionError)new AssertionError().initCause(e);
}
try {
mh.invokeExact();
} catch (Throwable e) {
e.printStackTrace();
}
}
Compiling with javac works fine, but on running:
bje at bje-desktop:~/projects/java_scratch/src$ java
-XX:+UnlockExperimentalVMOptions -XX:+EnableMethodHandles
-XX:+EnableInvokeDynamic com/db/java7/test/MHTest
java.dyn.WrongMethodTypeException: ()V cannot be called as ()V
at com.db.java7.test.MHTest.run(MHTest.java:33)
at com.db.java7.test.MHTest.main(MHTest.java:42)
bje at bje-desktop:~/projects/java_scratch/src$ java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b130)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b02, mixed mode)
Any ideas?
Thanks,
Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20110221/3e31ede4/attachment.html
More information about the mlvm-dev
mailing list