[groovy-user] Type uninitializedThis is not assignable to 'java/lang/Object'

104 views
Skip to first unread message

Matthias F. Brandstetter

unread,
Dec 11, 2014, 7:28:48 PM12/11/14
to us...@groovy.codehaus.org
Hello all,

I have a Groovy project (using Intellij), built with Gradle. Within that project there is a module which I have copied into a new module.

Each of these modules have a main script (new module: "glow.groovy"), which loads the module-specific main class (new module: "GlowGame"). All that logic incl. Gradle building works fine with the original module.

However, when I want to build and run the newly copied module, I get the following exception from Gradle. Unfortunately I have never seen such an error, and I have no idea how to read it.

Any ideas?

Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    glow/GlowGame.<init>()V @16: invokeinterface
  Reason:
    Type uninitializedThis (current frame, stack[4]) is not assignable to 'java/lang/Object'
  Current Frame:
    bci: @16
    flags: { flagThisUninit }
    locals: { uninitializedThis, '[Lorg/codehaus/groovy/runtime/callsite/CallSite;' }
    stack: { uninitializedThis, 'java/lang/String', 'org/codehaus/groovy/runtime/callsite/CallSite', 'org/codehaus/groovy/runtime/callsite/CallSite', uninitializedThis }
  Bytecode:
    0x0000000: b800 124c 2a12 142b 1215 322b 1216 322a
    0x0000010: b900 1c02 00b9 001f 0200 b800 25c0 0027
    0x0000020: 1229 122b b700 2e04 3d1c b800 3401 1236
    0x0000030: 1238 b800 3e1c 57b1                   

    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2663)
    at java.lang.Class.getDeclaredConstructors(Class.java:2012)
    at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:69)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:66)
    at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:64)
    at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
    at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
    at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:258)
    at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:213)
    at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:223)
    at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:168)
    at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:158)
    at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:141)
    at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:209)
    at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:241)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:255)
    at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:859)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
    at glow.run(glow.groovy:7)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:901)
    at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:884)
    at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:406)
    at org.codehaus.groovy.runtime.InvokerHelper$runScript.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
    at glow.main(glow.groovy)


--
Matthias F. Brandstetter
hai...@gmail.com

Jochen Theodorou

unread,
Dec 11, 2014, 9:16:40 PM12/11/14
to us...@groovy.codehaus.org
Am 12.12.2014 01:27, schrieb Matthias F. Brandstetter:
[...]
> Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
> Exception Details:
> Location:
> glow/GlowGame.<init>()V @16: invokeinterface
> Reason:
> Type uninitializedThis (current frame, stack[4]) is not assignable
> to 'java/lang/Object'
> Current Frame:
> bci: @16
> flags: { flagThisUninit }
> locals: { uninitializedThis,
> '[Lorg/codehaus/groovy/runtime/callsite/CallSite;' }
> stack: { uninitializedThis, 'java/lang/String',
> 'org/codehaus/groovy/runtime/callsite/CallSite',
> 'org/codehaus/groovy/runtime/callsite/CallSite', uninitializedThis }
> Bytecode:
> 0x0000000: b800 124c 2a12 142b 1215 322b 1216 322a
> 0x0000010: b900 1c02 00b9 001f 0200 b800 25c0 0027
> 0x0000020: 1229 122b b700 2e04 3d1c b800 3401 1236
> 0x0000030: 1238 b800 3e1c 57b1

This means the constructor for GlowGame has an bytecode error.
uninitializedThis is "this" in bytecode before the super call. since
stack has a CallSite, I strongly assume something is trying to make a
method call, before super is called. This is absolutely possible, if the
call is not done on "this". But this seems to be the case here.

This strongly suggests a situation like this:

class GlowGame {
GlowGame() {
super(foo()) // or this(foo())
}
....
}

I can see from the stack information that the call is without arguments
I think... anyway... do you have something like that in your code and is
foo a nonstatic method?

bye blackdrag

--
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


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Matthias F. Brandstetter

unread,
Dec 12, 2014, 7:12:00 AM12/12/14
to us...@groovy.codehaus.org
Thanks for your analysis, Jochen.
I am not at home right now, will check the code later and get back to you soon!

Cheers

Reply all
Reply to author
Forward
0 new messages