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

@ToString does not work for enum types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8-beta-2
    • 1.8.1
    • Compiler
    • None
    • tested on windows

    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

      Attachments

        Activity

          People

            paulk Paul King
            hamlet.darcy@canoo.com Hamlet D'Arcy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: