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

Stub generator creates invalid code for generated enums

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 1.8.6
    • None
    • None
    • WinXP SP3, Oracle JDK 1.7.0_05, gmaven-runtime-1.8 v1.4, groovy-all artifact v1.8.6

    Description

      I'm experiencing problems identical to those described in GROOVY-5212, but that issue is supposed to be fixed in 1.8.6. I have declared two public enums, and the build process fails because in the generated stubs they are declared as 'public final enum' which is syntactically invalid.

      Maven output:
      [INFO] Compiling 20 source files to C:\Documents and Settings\Administrator\digitizer\target\classes
      [INFO] -------------------------------------------------------------
      [ERROR] COMPILATION ERROR :
      [INFO] -------------------------------------------------------------
      [ERROR] C:\Documents and Settings\Administrator\digitizer\target\generated-sources\groovy-stubs\main\nz\ac\auckland\digitizer\streamer\StreamingAgent.java:[15,13] error: modifier final not allowed here
      [ERROR] C:\Documents and Settings\Administrator\digitizer\target\generated-sources\groovy-stubs\main\nz\ac\auckland\digitizer\agent\Agent.java:[31,13] error: modifier final not allowed here
      [INFO] 2 errors

      From Agent.groovy:

      abstract class Agent {
      enum State

      { NEW, RUN, WAIT, STOP, ERROR }

      protected Thread thread
      ...

      From StreamingAgent.groovy:

      public interface StreamingAgent {
      enum StreamState

      {STREAMING, IDLE, FINISHED, ERROR}

      void startStreaming(Recording rec)
      ...

      Apparently the patch submitted for GROOVY-5212 didn't work, or was not included in the release?

      What's strange is that for some time these enums were both compiling fine. But the stub generator has seemingly arbitrarily decided to start doing the wrong thing now.

      Attachments

        Activity

          People

            Unassigned Unassigned
            johansensen Alex Fulton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: