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/03 20:53:00 UTC
[jira] [Assigned] (GROOVY-6653) StackOverflow Exception when calling super.method when extending java class
[ https://issues.apache.org/jira/browse/GROOVY-6653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-6653:
-----------------------------------
Assignee: Eric Milles
> StackOverflow Exception when calling super.method when extending java class
> ---------------------------------------------------------------------------
>
> Key: GROOVY-6653
> URL: https://issues.apache.org/jira/browse/GROOVY-6653
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 2.2.1
> Reporter: Aleh Bich
> Assignee: Eric Milles
> Priority: Major
> Attachments: erroroutput.txt
>
>
> You can get StackOverflowError when running following code:
> {code:title=A.java}
> package test.java;
> public abstract class A<T> {
> protected String getText(T arg){
> return "Class A.";
> }
> }
> {code}
> {code:title=C.java}
> package test.java;
> public class C extends A<String> {
> @Override
> protected String getText(String arg){
> return super.getText(arg) + "Class C. ";
> }
> }
> {code}
> {code:title=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);
> }
> }
> {code}
> This bug occurs when class A is generic and method has parameterized argument.
> {code:title=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)
> {code}
> This bug looks similar to GROOVY-5385
--
This message was sent by Atlassian Jira
(v8.20.1#820001)