[jira] [Created] (GROOVY-8693) Calling indirect default interface methods fails both dynamic/static compiled

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (GROOVY-8693) Calling indirect default interface methods fails both dynamic/static compiled

JIRA jira@apache.org
Christoph Frick created GROOVY-8693:
---------------------------------------

             Summary: Calling indirect default interface methods fails both dynamic/static compiled
                 Key: GROOVY-8693
                 URL: https://issues.apache.org/jira/browse/GROOVY-8693
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.5.0
            Reporter: Christoph Frick


Given _<interface> Intr <|- Impl <| SubImpl_ where _Intr_ is an Java8 interface with a default implementation, running _SubImpl_ fails both with _CompileDynamic:_

Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: sut.SubImpl.doSomething() is applicable for argument types: () values: []
Possible solutions: doSomething(), toString(), toString()
 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:72)
 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:148)
 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:166)
 at sut.SubImpl.doSomething(SubImpl.groovy:6)
 at sut.Intr$doSomething.call(Unknown Source)
 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
 at sut.Main.main(Main.groovy:8)

and -_Static_.

Exception in thread "main" java.lang.VerifyError: Bad invokespecial instruction: interface method reference is in an indirect superinterface.
Exception Details:
 Location:
 sut/SubImpl.doSomething()V @1: invokespecial
 Reason:
 Error exists in the bytecode
 Bytecode:
 0x0000000: 2ab7 0014 0157 2a12 16b8 001c 0157 b1

at java.lang.Class.getDeclaredConstructors0(Native Method)
 at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
 at java.lang.Class.getDeclaredConstructors(Class.java:2020)
 at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:88)
 at java.security.AccessController.doPrivileged(Native Method)
 at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:86)
 at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:81)
 at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:50)
 at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:37)
 at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:311)
 at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:218)
 at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:228)
 at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:171)
 at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:161)
 at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:144)
 at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:288)
 at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:331)
 at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:270)
 at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:976)
 at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:86)
 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59)
 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:238)
 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:242)
 at sut.Main.main(Main.groovy:8)

 

See a full example here: https://github.com/christoph-frick/groovy-inheritance-vs-default-interface-method



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)