Le 11/08/2009 21:15, Wei Yin Teo a écrit :
It doesn't work. :(


java.dyn.NoAccessException: receiver must be in caller class: InstanceTest/27271057.<init>()void, from test.AnonymousClassLoading
at sun.dyn.MemberName.newNoAccessException(MemberName.java:421)
at java.dyn.MethodHandles.unreflectImpl(MethodHandles.java:496)
at java.dyn.MethodHandles$Lookup.unreflectConstructor(MethodHandles.java:408)
at test.AnonymousClassLoading.testLoading(AnonymousClassLoading.java:50)

This is another bug :(
Not your lucky day :)

This one is funny because this is a bug totally in the mind of the programmer.
There is a mismatch, the reflection API says "constructor dot invoke"
which for the VM means "call <init>()" but it means create a new instance.
So here, the code tries to just called the <init> method
and failed because you are not in caller class.

To summarize, unreflectConstructor() is currently broken :(

Rémi



_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to