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

StackoverflowError when using an abstract class with generic parameters as the return value of a closure

    XMLWordPrintableJSON

Details

    Description

      If you try to compile the project at https://github.com/demus-nine/groovy-class-generic-stackoverflowerror groovyc crashes with a StackoverflowError. This happens in org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport#applyGenericsContext(java.util.Map<org.codehaus.groovy.ast.GenericsType.GenericsTypeName,org.codehaus.groovy.ast.GenericsType>, org.codehaus.groovy.ast.ClassNode) in this bit of recursive code:

      if (bound.isArray()) {
          return applyGenericsContext(spec, bound.getComponentType()).makeArray();
      }
      

      although I have seen it throw in other methods in the StaticTypeCheckingSupport class.

       

      The class that is being handled is an abstract class with a generic parameter, but in the code using the type there aren't enough hints to the compiler to resolve the generic constraint, possibly because it is self-referential.

      Attachments

        Activity

          People

            emilles Eric Milles
            demus Daniel Demus
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: