[
https://issues.apache.org/jira/browse/GROOVY-11193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17778786#comment-17778786
]
Jochen Theodorou commented on GROOVY-11193:
-------------------------------------------
[~emilles] I am not so much worried about having one version of Groovy for
compilation and another for test execution, I am worried about a library
compiled with Groovy 2 or 3 no longer working in Groovy 4. For smoothing this
over: How about a new method in ScriptBytecodeInterface like
invokeMethodOnSuperN2. I am not fully aware of what you changed. But when I
implemented the calls for default methods I noticed some "strange" (aka logic
that looks unfamiliar even though it should have been) code for the caller
class. My goal would actually be to replace the calls for super in Groovy 5
with invokedynamic.
> Methods referenced by super cannot be found and are not executed
> ----------------------------------------------------------------
>
> Key: GROOVY-11193
> URL: https://issues.apache.org/jira/browse/GROOVY-11193
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.0
> Reporter: Marek Parfianowicz
> Assignee: Eric Milles
> Priority: Major
> Attachments: bug.zip
>
>
> When one method calls another method from a parent class via {{super}}
> keyword, the code is not executed at all.
> I tested this in version 4.0.0 and 4.0.14 - in both it fails. (x)
> It works correctly in 3.0.19. (/)
> It also fails in 2.5.23, but with a runtime exception -
> "{color:#172b4d}java.lang.AbstractMethodError" (x){color}
> Code to reproduce:
>
> {code:java}
> class MyClassBase {
> void setUp() {
> System.out.println("Called MyTestBase.setUp")
> }
> }{code}
>
> {code:java}
> class MyClass extends MyClassBase {
> void setUp() {
> super.setUp()
> System.out.println("Called MyTest.setUp")
> }
> static void main(String[] args) {
> System.out.println("About to create MyClass")
> MyClass my = new MyClass();
> my.setUp()
> }
> } {code}
> Output for Groovy 4.0.14:
> {noformat}
> [INFO] --- exec-maven-plugin:3.0.0:java (default) @ bug ---
> About to create MyClass
> [WARNING]
> groovy.lang.MissingMethodException: No signature of method:
> MyClassBase.setUp() is applicable for argument types: () values: []
> Possible solutions: setUp(), getAt(java.lang.String),
> tap(groovy.lang.Closure), sleep(long), sleep(long, groovy.lang.Closure),
> dump()
> 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 MyClass.setUp (MyClass.groovy:3)
> at MyClass$setUp.call (Unknown Source)
> at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall
> (CallSiteArray.java:45)
> at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call
> (AbstractCallSite.java:125)
> at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call
> (AbstractCallSite.java:130)
> at MyClass.main (MyClass.groovy:10)
> at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:254)
> at java.lang.Thread.run (Thread.java:750)
> {noformat}
> Please see the attached bug.zip sample project.
>
> Workaround:
> Use {{@CompileStatic}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)