Groovy
  1. Groovy
  2. GROOVY-4570

@ToString does not work for enum types

    Details

    • Type: Bug Bug
    • Status: 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

      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

        Hamlet D'Arcy created issue -
        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
        Paul King made changes -
        Field Original Value New Value
        Fix Version/s 1.8.1 [ 17223 ]
        Assignee Paul King [ paulk ]
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12733504 ] Default workflow, editable Closed status [ 12745321 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12971065 ] Default workflow, editable Closed status [ 12978818 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        178d 22h 59m 1 Paul King 06/Jun/11 01:25
        Resolved Resolved Closed Closed
        45d 18h 41m 1 Paul King 21/Jul/11 20:06

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development