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

Setting protected field using named arguments in constructor silently fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-2
    • 1.1-beta-1
    • None
    • None
    • Java 1.5.0_03 Windows XP

    Description

      The following code:

      class Bubbles {
      protected int x = 0;
      public String toString()

      { ""+x }

      }
      def b = new Bubbles(x:5)
      println b

      prints 0, not 5. If x is changed to public, it works fine.

      Unless I'm missing something, this should throw a run time error that you can't set the protected field/property.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mcspanky Martin C. Martin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: