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

Strange behavior for properties that differ only in their capitalization

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

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7-beta-1
    • 1.6.5, 1.7-beta-2
    • Compiler
    • None
    • Mac OS 10.5.8
      Java 1.5.0_19

    Description

      class Foo {
        def F = 1
        def f = 2
      }
      
      def foo = new Foo()
      foo.F = 5 // output remains the same if we change this to: foo.f = 5
      
      println foo.@f // 2
      println foo.@F // 5
      
      println foo.f  // 5
      println foo.F  // 5
      
      println foo.getProperty("f") // 5
      println foo.getProperty("F") // 5
      

      The funny thing is that if the lower-case property definition comes first...

      class Foo {
        def f = 2
        def F = 1
      }
      

      ... then the output is much more sensible (2 5 2 5 2 5).

      Attachments

        Activity

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

          People

            roshandawrani Roshan Dawrani
            pniederw Peter Niederwieser
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment