You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/12/02 19:29:00 UTC
[jira] [Comment Edited] (GROOVY-8693) Calling indirect default interface methods fails both dynamic/static compiled
[ https://issues.apache.org/jira/browse/GROOVY-8693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17452475#comment-17452475 ]
Eric Milles edited comment on GROOVY-8693 at 12/2/21, 7:28 PM:
---------------------------------------------------------------
https://github.com/apache/groovy/commit/cae5301aa9c9a274d92a760ecb70e057d746fb65
https://github.com/apache/groovy/commit/b5c7e1ce9e1838eef5a7eb9b6373587afa9ca24e
https://github.com/apache/groovy/commit/6ccf8d74afc81c70f75125f3ed347f7587d7c2e9
https://github.com/apache/groovy/commit/7cd12222cbd8b7210fc0b3dc64de8e03c46d2e8f
was (Author: emilles):
https://github.com/apache/groovy/commit/cae5301aa9c9a274d92a760ecb70e057d746fb65
https://github.com/apache/groovy/commit/b5c7e1ce9e1838eef5a7eb9b6373587afa9ca24e
https://github.com/apache/groovy/commit/6ccf8d74afc81c70f75125f3ed347f7587d7c2e9
> 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
> Assignee: Eric Milles
> Priority: Major
> Labels: default-methods
> Fix For: 4.0.0-rc-1
>
>
> Given _<interface> Intr <|- Impl <| SubImpl_ where _Intr_ is an Java8 interface with a default implementation, running _SubImpl_ fails both with _CompileDynamic:_
> {noformat}
> 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)
> {noformat}
> and -_Static_.
> {noformat}
> 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)
> {noformat}
> See a full example here: https://github.com/christoph-frick/groovy-inheritance-vs-default-interface-method
--
This message was sent by Atlassian Jira
(v8.20.1#820001)