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

Enum constructor doesn't work properly with variable arguments

    XMLWordPrintableJSON

Details

    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

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: