groovy
  1. groovy
  2. GROOVY-3276

Enums in 1.6-RC-1 no longer work with constructors with multiple parameters

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.6-rc-1
    • Fix Version/s: 1.6-rc-2, 1.5.8, 1.7-beta-1
    • Component/s: None
    • Labels:
      None
    • Environment:
      XP, cygwin,
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build 1.6.0-b105)
      Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode)
    • Number of attachments :
      0

      Description

      In 1.6 RC1 it seems to no longer be possible for an enum constructor to take more than one parameter. This works fine in 1.5.7:

      enum Foo {
      A(1,2),
      B(3,4)

      Foo(int xx, int yy)

      { x=xx y=yy }

      public int x
      public int y
      }

      Foo.A.x

      gives:

      Exception thrown: null

      java.lang.ExceptionInInitializerError

      at ConsoleScript38.class$(ConsoleScript38)

      at ConsoleScript38.$get$$class$Foo(ConsoleScript38)

      at ConsoleScript38.run(ConsoleScript38:14)

      Caused by: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: Foo(java.lang.String, java.lang.Integer, java.util.ArrayList)

      at Foo.$INIT(ConsoleScript38)

      at Foo.<clinit>(ConsoleScript38:3)

      ... 3 more

        Activity

        Hide
        Roshan Dawrani added a comment -

        Fixed

        Show
        Roshan Dawrani added a comment - Fixed
        Hide
        Guillaume Laforge added a comment -

        The problem is also present in 1.6/1.7?

        Show
        Guillaume Laforge added a comment - The problem is also present in 1.6/1.7?
        Hide
        Roshan Dawrani added a comment -

        I am not sure I understand the question. it was present on all 3 branches - 1.5.x, 1.6.x and trunk and on all 3 I have fixed and marked so.

        Show
        Roshan Dawrani added a comment - I am not sure I understand the question. it was present on all 3 branches - 1.5.x, 1.6.x and trunk and on all 3 I have fixed and marked so.

          People

          • Assignee:
            Roshan Dawrani
            Reporter:
            Chris Currivan
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: