Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.2.1
-
None
Description
You can get StackOverflowError when running following code:
A.java
package test.java; public abstract class A<T> { protected String getText(T arg){ return "Class A."; } }
C.java
package test.java; public class C extends A<String> { @Override protected String getText(String arg){ return super.getText(arg) + "Class C. "; } }
D.groovy
package test.java class D extends C { @Override protected String getText(String arg) { return super.getText(arg) + 'Class D.'; } public static void main(String[] args) { D d = new D(); String res = d.getText(null); println(res); } }
This bug occurs when class A is generic and method has parameterized argument.
Output
Exception in thread "main" java.lang.StackOverflowError
at test.java.D.getText(D.groovy)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128)
at test.java.D.getText(D.groovy:6)
at test.java.D.getText(D.groovy)
This bug looks similar to GROOVY-5385
Attachments
Attachments
Issue Links
- relates to
-
GROOVY-10594 Unable to Call StringBuilder.substring() method (JDK17, Groovy 3)
- Closed