You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2016/06/26 10:29:33 UTC

[jira] [Commented] (GROOVY-7722) StackOverflowError when use anonymous class with generics.

    [ https://issues.apache.org/jira/browse/GROOVY-7722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15350069#comment-15350069 ] 

Paul King commented on GROOVY-7722:
-----------------------------------

debug info:
{noformat}
genericsSpec = {T=Subscriber <? super T -> java.lang.Object> -> Subscriber <T>}, isEmpty=false
oldLower = T -> java.lang.Object
exclusions = []
oldgType = ? super T
...
genericsSpec = {T=Subscriber <? super T -> java.lang.Object> -> Subscriber <T>}, isEmpty=false
oldLower = T -> java.lang.Object
exclusions = []
oldgType = ? super T
{noformat}

> StackOverflowError when use anonymous class with generics.
> ----------------------------------------------------------
>
>                 Key: GROOVY-7722
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7722
>             Project: Groovy
>          Issue Type: Bug
>          Components: ast builder
>    Affects Versions: 2.4.4
>         Environment: Groovy Version: 2.4.4 JVM: 1.8.0_51 Vendor: Oracle Corporation OS: Mac OS X
>            Reporter: taka men
>   Original Estimate: 12h
>  Remaining Estimate: 12h
>
> I put a sample code to GitHub.
> https://github.com/takahirom/groovy-stackoverflow-bug
> I can reproduce it following code. And This error hasn't occurred in java8.
> {code}
> import java.util.*;
> interface Action1<T> {
>     void call(T t);
> }
> abstract class Subscriber<T> {
> }
> interface OnSubscribe<T> extends Action1<Subscriber<? super T>> {
> }
> new OnSubscribe<List>() {
>         @Override
>         public void call(Subscriber<? super List> o){
>                 System.out.println("called");
>         }
> }.call(null);
> {code}
> StackTrace:
> {noformat}
> $groovy -d Test.groovy  
> Caught: java.lang.StackOverflowError
> java.lang.StackOverflowError
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:318)
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:342)
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:342)
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:342)
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:342)
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:342)
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:342)
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:342)
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:342)
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:342)
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:342)
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:342)
>         at org.codehaus.groovy.ast.tools.GenericsUtils.correctToGenericsSpecRecurse(GenericsUtils.java:342)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)