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

setter method for mixed case properties is not found

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-6
    • 1.0-beta-7
    • None
    • None
    • Windows XP, jdk1.4

    Description

      If a setter method for a mixed case property is used,
      the property cannot be set.
      Resulting error: Cannot set read-only property: mixedCaseProperty

      Example: MixedCasePropertyBug.groovy

      bean = new MixedCasePropertyBean()
      bean.mixedCaseProperty = "test" // this should work but dont
      println(bean.mixedCaseProperty)
      //bean.mixedcaseproperty = "test" // this shouldnt work but does
      //println(bean.mixedcaseproperty)

      class MixedCasePropertyBean {
      private mixedCaseProperty
      public getMixedCaseProperty()

      { mixedCaseProperty }

      public setMixedCaseProperty(val)

      { this.mixedCaseProperty = val }

      }
      -----------------------------------

      I have tracked down the error to MetaClass.setUpProperties.
      Line 793 and 820 should be:
      String propName = methodName.substring(3,4).toLowerCase() + methodName.substring(4);

      Instead of:
      String propName = methodName.substring(3).toLowerCase();

      Attachments

        Activity

          People

            tug John Wilson
            tof Christof Vollrath
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0.5h
                0.5h
                Remaining:
                Remaining Estimate - 0.5h
                0.5h
                Logged:
                Time Spent - Not Specified
                Not Specified