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

StackOverflowError in STC

    XMLWordPrintableJSON

    Details

      Description

      This appears similar to GROOVY-9565, but it's happening in a context that is generics-free as far as I can tell.

      Caused by: java.lang.StackOverflowError
          at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.isUsingGenerics (DecompiledClassNode.java:86)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsContext (StaticTypeCheckingSupport.java:1880)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsContext (StaticTypeCheckingSupport.java:1870)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsContext (StaticTypeCheckingSupport.java:1827)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsContext (StaticTypeCheckingSupport.java:1816)
          at org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.applyGenericsContext (StaticTypeCheckingSupport.java:1882)
      

      I managed attempted to trim down the example, but not without referring to the TinkerPop classes (3.4.8). This code triggers the recursion:

      import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource
      import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy
      import org.apache.tinkerpop.gremlin.structure.Graph
      
      import groovy.transform.CompileStatic
      
      @CompileStatic
      class Groovy9822 {
          static GraphTraversalSource readOnly(Graph graph) {
              def i = ReadOnlyStrategy.instance()
              graph.traversal().withStrategies(i)
          }
      }
      

      Removing the second i so that the varargs is empty and the instance is not passed to withStrategies prevents the error. (In the original code, the invocation was inline with no local variable; I introduced it to make comparative demonstration easier, and its presence seems to be irrelevant.) In case it is relevant, the withStrategies method takes a non-generic TraversalStrategy..., but the class declaration of ReadOnlyStrategy is as follows:

      public final class ReadOnlyStrategy extends AbstractTraversalStrategy<TraversalStrategy.VerificationStrategy> implements TraversalStrategy.VerificationStrategy
      

        Attachments

          Activity

            People

            • Assignee:
              emilles Eric Milles
              Reporter:
              chrylis Christopher Smith
            • Votes:
              0 Vote for this issue
              Watchers:
              2 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 - 10m
                10m