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

Enum constructor doesn't work properly with variable arguments

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.2.2
    • 2.4.0-beta-4
    • Compiler

    Description

      enum Test {
          TEST1(1, 2, 3)
      
          Test(Integer... ints) {
              println ints
          }
      }
      
      println Test.TEST1
      

      This code gives me only "[1]", but it should be "[1,2,3]"

      In Java everything is fine:

      public enum Test {
        TEST1(1, 2, 3);
        
        Test(Integer... ints) {
          System.out.println(java.util.Arrays.toString(ints));
        }
      
        public static void main(String []args){}
      }
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            blackdrag Jochen Theodorou
            bsideup Sergei Egorov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment