[ 
https://issues.apache.org/jira/browse/GROOVY-9822?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King closed GROOVY-9822.
-----------------------------

> StackOverflowError in STC
> -------------------------
>
>                 Key: GROOVY-9822
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9822
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 3.0.6
>            Reporter: Christopher Smith
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 2.5.14, 3.0.7, 4.0.0-alpha-2
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> This appears similar to GROOVY-9565, but it's happening in a context that is 
> generics-free as far as I can tell. 
> {code}
> 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)
> {code}
> I managed attempted to trim down the example, but not without referring to 
> the TinkerPop classes (3.4.8). This code triggers the recursion:
> {code:groovy}
> 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)
>     }
> }
> {code}
> 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:
> {code:java}
> public final class ReadOnlyStrategy extends 
> AbstractTraversalStrategy<TraversalStrategy.VerificationStrategy> implements 
> TraversalStrategy.VerificationStrategy
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to