Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.6
-
None
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