groovy
  1. groovy
  2. GROOVY-3155

Stack overflow during compilation

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.7
    • Fix Version/s: 1.6.3, 1.7-beta-1
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      Ubuntu 8.10, Java 5
    • Number of attachments :
      0

      Description

      I get:
      java.lang.StackOverflowError
      at org.codehaus.groovy.ast.ClassNode.equals(ClassNode.java:575)
      at org.codehaus.groovy.ast.ClassNode.equals(ClassNode.java:573)
      at org.codehaus.groovy.ast.ClassNode.declaresInterfaceDirect(ClassNode.java:803)
      at org.codehaus.groovy.ast.ClassNode.declaresInterface(ClassNode.java:786)
      at org.codehaus.groovy.ast.ClassNode.declaresInterface(ClassNode.java:792)
      at org.codehaus.groovy.ast.ClassNode.declaresInterface(ClassNode.java:792)
      ...

      the project has mixed java & groovy sources.
      Not sure where the issue is, so can't reproduce with a small set of files

        Activity

        Hide
        blackdrag blackdrag added a comment -

        that's the first time we get something like that... could you please give the full trace, because from the part I see I cannot see where the loop should be, that is causing the StackOverflowError.

        Show
        blackdrag blackdrag added a comment - that's the first time we get something like that... could you please give the full trace, because from the part I see I cannot see where the loop should be, that is causing the StackOverflowError.
        Hide
        Yegor Bryukhov added a comment -

        get the same problem on Sun Java 6 with compilation targeting 1.5 (this is set across many modules so I can't easily try targeting 1.6)

        Show
        Yegor Bryukhov added a comment - get the same problem on Sun Java 6 with compilation targeting 1.5 (this is set across many modules so I can't easily try targeting 1.6)
        Hide
        Yegor Bryukhov added a comment -

        the loop is exactly at 792, that's why I cut it there, the last two lines repeat "forever"

        Show
        Yegor Bryukhov added a comment - the loop is exactly at 792, that's why I cut it there, the last two lines repeat "forever"
        Hide
        Yegor Bryukhov added a comment -

        I had:

        class NodeViewFactory extends RootFactory implements NodeViewFactory

        { ... }

        note the same name of the defined class and the interface it is about to implement.
        After I change the name of the interface, the problem disappears.
        Still not a good way to inform a user about a problem in his code

        Show
        Yegor Bryukhov added a comment - I had: class NodeViewFactory extends RootFactory implements NodeViewFactory { ... } note the same name of the defined class and the interface it is about to implement. After I change the name of the interface, the problem disappears. Still not a good way to inform a user about a problem in his code
        Hide
        blackdrag blackdrag added a comment -

        ah, ok, that information is what I needed. we had a similar loop somewhere else.

        Show
        blackdrag blackdrag added a comment - ah, ok, that information is what I needed. we had a similar loop somewhere else.
        Hide
        Roshan Dawrani added a comment -

        This has already been fixed - as part of GROOVY-2855 (since 1.6.3/1.7-beta-1).

        Running the code

        class RootFactory {}
        class NodeViewFactory extends RootFactory implements NodeViewFactory {}
        

        results now in compilation error

        org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, ..\Try.groovy: 2: Cycle detected: the type NodeViewFactory cannot implement itself
        . At [2:1]  @ line 2, column 1.
           class NodeViewFactory extends RootFactory implements NodeViewFactory {}
           ^
        
        1 error
        
        Show
        Roshan Dawrani added a comment - This has already been fixed - as part of GROOVY-2855 (since 1.6.3/1.7-beta-1). Running the code class RootFactory {} class NodeViewFactory extends RootFactory implements NodeViewFactory {} results now in compilation error org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, ..\Try.groovy: 2: Cycle detected: the type NodeViewFactory cannot implement itself . At [2:1] @ line 2, column 1. class NodeViewFactory extends RootFactory implements NodeViewFactory {} ^ 1 error
        Hide
        Aaron Pieper added a comment -

        I am still encountering this issue. I am using a groovy plugin for Eclipse; according to Eclipse, it is Groovy Compiler version 1.7.2.20100410-2100-e35. It occurs whenever I make a groovy class implement itself.

        Show
        Aaron Pieper added a comment - I am still encountering this issue. I am using a groovy plugin for Eclipse; according to Eclipse, it is Groovy Compiler version 1.7.2.20100410-2100-e35. It occurs whenever I make a groovy class implement itself.
        Hide
        Roshan Dawrani added a comment -

        Please try it outside the groovy eclipse environment (command line, groovy console, groovy web console) and see whether you still get the issue. If not, then you need to report the issue to GRECLIPSE project that handles groovy eclipse plugin.

        Show
        Roshan Dawrani added a comment - Please try it outside the groovy eclipse environment (command line, groovy console, groovy web console) and see whether you still get the issue. If not, then you need to report the issue to GRECLIPSE project that handles groovy eclipse plugin.

          People

          • Assignee:
            Roshan Dawrani
            Reporter:
            Yegor Bryukhov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: