Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.3
    • Fix Version/s: 1.7.4, 1.8-beta-1
    • Component/s: Compiler
    • Labels:
      None
    • Number of attachments :
      1

      Description

      The following code compiles in 1.7.2, but not in 1.7.3:

      private enum EnumWithToString {
        VALUE
        String toString() { "I'm a value" }
      }
      

      groovyc output:

      unexpected token: VALUE @ line 337, column 3.
           VALUE
           ^
      
      1 error
      

      The compile error goes away when adding a semicolon after "VALUE".

        Activity

        Hide
        Roshan Dawrani added a comment -

        Looks to be caused by r19830 (on groovy.g) - changes made for GROOVY-3986 and GROOVY-3047.

        If I revert that change, the given example compiles fine again.

        I suspect that in particular, it is due to GROOVY-3047(enum definition does not allow trailing comma), but I can't be sure as fixes for 2 JIRAs are combined in the same revision (which I wish weren't but may be they were too inter-dependent).

        Anyway we seem to have the regression r19830 onwards.

        Show
        Roshan Dawrani added a comment - Looks to be caused by r19830 (on groovy.g) - changes made for GROOVY-3986 and GROOVY-3047 . If I revert that change, the given example compiles fine again. I suspect that in particular, it is due to GROOVY-3047 (enum definition does not allow trailing comma), but I can't be sure as fixes for 2 JIRAs are combined in the same revision (which I wish weren't but may be they were too inter-dependent). Anyway we seem to have the regression r19830 onwards.
        Hide
        Paul King added a comment -

        proposed patch attached

        Show
        Paul King added a comment - proposed patch attached
        Hide
        Roshan Dawrani added a comment -

        I tried testing it and found no further issues.

        Show
        Roshan Dawrani added a comment - I tried testing it and found no further issues.
        Hide
        Paul King added a comment -

        Patch applied. Peter, thanks for spotting this and Roshan, thanks for the cross-check.

        Show
        Paul King added a comment - Patch applied. Peter, thanks for spotting this and Roshan, thanks for the cross-check.

          People

          • Assignee:
            Paul King
            Reporter:
            Peter Niederwieser
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: