Hi all,
I have here an issue that is driving me crazy - and I have the hope
someone reading this here may have an idea what is wrong. So basically I
have this code in Groovy:
G4410JavaStringProducer jsp = new G4410JavaStringProducer()
which atm gets compiled to something like this:
ALOAD 1
LDC 3
AALOAD
INVOKESTATIC
groovy/bugs/test.$get$$class$groovy$bugs$G4410JavaStringProducer
()Ljava/lang/Class;
INVOKEINTERFACE
org/codehaus/groovy/runtime/callsite/CallSite.callConstructor
(Ljava/lang/Object;)Ljava/lang/Object;
INVOKESTATIC
groovy/bugs/test.$get$$class$groovy$bugs$G4410JavaStringProducer
()Ljava/lang/Class;
INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType
(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
CHECKCAST groovy/bugs/G4410JavaStringProducer
ASTORE 6
ugly and inefficient, but I am working on that... anyway.. the problem
is that this code makes problems. G4410JavaStringProducer is package
private class in groovy.bugs and this class is in the same package... I
veryfied that the callConstructor call works, that the castToType call
works as well... then my debugger jumps to
ClassLoader#checkPackageAccess for the class
groovy.bugs.G4410JavaStringProducer with no SecurityManager set.
And the next thing my debugger stops is is then suddenly the constructor
of IllegalAccessError with
java.lang.IllegalAccessError: tried to access class
groovy.bugs.G4410JavaStringProducer from class groovy.bugs.test
the parent stack frame for the constructor call is the stack frame of
the groovy program, so there is nothing in between.
So now... what is this error? afaik the program is allowed to access the
class. I was not able to reproduce the problem in pure Java. It is a
totally strange thing to me.
If I change the program to
def jsp = new G4410JavaStringProducer()
then the CHECKCAST and the castToType call will not in there and the
error vanishes as well... and the only thing I can say here atm is that
I am absolutely clueless as of what the problem is.
Does anyone at least have a hint what could be wrong here? I am
thankful for every idea.
bye Jochen
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/
--
You received this message because you are subscribed to the Google Groups "JVM
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jvm-languages?hl=en.