You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Christopher Smith (Jira)" <ji...@apache.org> on 2020/11/19 06:16:00 UTC

[jira] [Updated] (GROOVY-9822) StackOverflowError in STC

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

Christopher Smith updated GROOVY-9822:
--------------------------------------
    Description: 
This appears similar to GROOVY-9565, but it's happening in a context that is generics-free as far as I can tell. I have the following pair of files, where the graph-related types are from TinkerPop:

{code:groovy}
@CompileStatic
interface GremlinAccess {
    GraphTraversalSource readOnly()

    GremlinSession session()

    interface GremlinSession extends AutoCloseable {
        GraphTraversalSource traversal()
    }
}
{code}

{code:groovy}
@TupleConstructor(defaults = false)
@CompileStatic
class GraphObjectGremlinAccess implements GremlinAccess {
    final Graph graph

    @Override
    GraphTraversalSource readOnly() {
        graph.traversal().withStrategies(ReadOnlyStrategy.instance())
    }

    @Override
    GremlinSession session() {
        new PlaceboGremlinSession()
    }


    private class PlaceboGremlinSession implements GremlinSession {
        @Override
        void close() {}

        @Override
        GraphTraversalSource traversal() {
            graph.traversal()
        }
    }
}
{code}

The first file compiles without problem. The second file triggers a stack overflow, looping the four lines from 1870 to 1882:

{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'm attempting to trim down the example.

  was:
This appears similar to GROOVY-9565, but it's happening in a context that is generics-free as far as I can tell. I have the following pair of files, where the graph-related types are from TinkerPop:

{code:groovy}
@CompileStaticinterface GremlinAccess {
    GraphTraversalSource readOnly()

    GremlinSession session()

    interface GremlinSession extends AutoCloseable {
        GraphTraversalSource traversal()
    }
}
{code}

{code:groovy}
@TupleConstructor(defaults = false)
@CompileStatic
class GraphObjectGremlinAccess implements GremlinAccess {
    final Graph graph

    @Override
    GraphTraversalSource readOnly() {
        graph.traversal().withStrategies(ReadOnlyStrategy.instance())
    }

    @Override
    GremlinSession session() {
        new PlaceboGremlinSession()
    }


    private class PlaceboGremlinSession implements GremlinSession {
        @Override
        void close() {}

        @Override
        GraphTraversalSource traversal() {
            graph.traversal()
        }
    }
}
{code}

The first file compiles without problem. The second file triggers a stack overflow, looping the four lines from 1870 to 1882:

{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'm attempting to trim down the example.


> 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
>            Priority: Major
>
> This appears similar to GROOVY-9565, but it's happening in a context that is generics-free as far as I can tell. I have the following pair of files, where the graph-related types are from TinkerPop:
> {code:groovy}
> @CompileStatic
> interface GremlinAccess {
>     GraphTraversalSource readOnly()
>     GremlinSession session()
>     interface GremlinSession extends AutoCloseable {
>         GraphTraversalSource traversal()
>     }
> }
> {code}
> {code:groovy}
> @TupleConstructor(defaults = false)
> @CompileStatic
> class GraphObjectGremlinAccess implements GremlinAccess {
>     final Graph graph
>     @Override
>     GraphTraversalSource readOnly() {
>         graph.traversal().withStrategies(ReadOnlyStrategy.instance())
>     }
>     @Override
>     GremlinSession session() {
>         new PlaceboGremlinSession()
>     }
>     private class PlaceboGremlinSession implements GremlinSession {
>         @Override
>         void close() {}
>         @Override
>         GraphTraversalSource traversal() {
>             graph.traversal()
>         }
>     }
> }
> {code}
> The first file compiles without problem. The second file triggers a stack overflow, looping the four lines from 1870 to 1882:
> {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'm attempting to trim down the example.



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