groovy
  1. groovy
  2. GROOVY-4570

@ToString does not work for enum types

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8-beta-2
    • Fix Version/s: 1.8.1
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      tested on windows
    • Number of attachments :
      0

      Description

      @ToString does not appear to work for enums. This code does not cause a toString method to be generated and it should:

      @groovy.transform.ToString 
      enum MyEnum {
        FOO('foo'), 
        BAR('bar'); 
        String prop
        MyEnum(String p) {prop = p }
      }
      
      println MyEnum.FOO.toString()
      

      THere might be a larger issue with AST Transforms on Enums in general. See thread here: http://groovy.329449.n5.nabble.com/AST-transformations-for-enum-td3295912.html

        Activity

        Hide
        Paul King added a comment -

        fixed - should also fix other transforms too

        Show
        Paul King added a comment - fixed - should also fix other transforms too

          People

          • Assignee:
            Paul King
            Reporter:
            Hamlet D'Arcy
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: