Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7722

StackOverflowError when use anonymous class with generics.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.4
    • Fix Version/s: 2.5.9, 3.0.0-rc-2
    • Component/s: ast builder
    • Labels:
      None
    • Environment:
      Groovy Version: 2.4.4 JVM: 1.8.0_51 Vendor: Oracle Corporation OS: Mac OS X

      Description

      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.

      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);
      

      StackTrace:

      $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)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                emilles Eric Milles
                Reporter:
                takahirom taka men
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h