Spurious NPE in guardWithTest

Rémi Forax forax at univ-mlv.fr
Tue Dec 14 09:02:22 PST 2010


With the jdk7b121, sometimes when I call a MH created with guardWith, it 
get a NPE because the target is NULL :(

groovy examples/mixin.groovy

java.lang.NullPointerException
     at 
sun.dyn.MethodHandleImpl$GuardWithTest.invoke_L1(MethodHandleImpl.java:963)
     at java.dyn.MethodHandle.invokeVarargs(MethodHandle.java:336)
     at org.codehaus.groovy2.lang.MOPLinker.fallback(MOPLinker.java:145)
     at sun.dyn.FilterGeneric$F1.invoke_C0(FilterGeneric.java:516)
     at mixin.run(Unknown Source)
     at 
groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(GroovyShell.java:264)
     at groovy.lang.GroovyShell.run(GroovyShell.java:227)
     at groovy.lang.GroovyShell.run(GroovyShell.java:157)
     at groovy.ui.GroovyMain.processOnce(GroovyMain.java:496)
     at groovy.ui.GroovyMain.run(GroovyMain.java:311)
     at groovy.ui.GroovyMain.process(GroovyMain.java:297)
     at groovy.ui.GroovyMain.processArgs(GroovyMain.java:112)
     at groovy.ui.GroovyMain.main(GroovyMain.java:93)
Caught: java.lang.NullPointerException

Because MHs.guardWithTest() explicitly test that the target is not null,
I think there is a bug somewhere in the VM.

Step to reproduce:
download Gru: http://www-igm.univ-mlv.fr/~forax/tmp/Gru.tgz

run: groovy examples/mixin.groovy

It should print some bytecodes and "groovy yai" ...
if there is no NPE.

Rémi
PS: yes, Gru a prototype of groovy on top of JSR292 :)



More information about the mlvm-dev mailing list