How to making Class.forName work in indy?
Jochen Theodorou
blackdrag at gmx.org
Tue Jul 10 13:07:50 PDT 2012
Hi all,
assuming you have to compile code with indy that realizes this:
Class.forName(x)
Meaning, we want to execute forName from Class using invokedynamic. If
you then have frames in your trace looking like this:
> java.lang.Class.forName0(Native Method)
> java.lang.Class.forName(Class.java:186)
> java.lang.invoke.MethodHandleImpl$GuardWithCatch.invoke_L2(MethodHandleImpl.java:1130)
> org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:680)
> groovy.util.JavadocAssertionTestSuite.<clinit>(JavadocAssertionTestSuite.groovy:71)
then it is clear to me, why it is failing. At least the Indyinterface
part, if not even the GuradWithCatch part are disturbing the stack
walking Class#forName is using.
has anyone any idea on how to make this work across JVMs? One version,
that sounds quite crazy to me, but may just work, is to compile a helper
method on the class, that directly calls Class#forName and thus making
it work, since there is no longer a wrong stack frame at the position
Class#forName is looking for. But well... it may be a possibility
bye Jochen
--
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org
More information about the mlvm-dev
mailing list