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

Explicit private getter method is executed if an implicit getter method exists because of a public property.

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

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.1
    • 2.3.7
    • groovy-runtime
    • None
    • OS X

    Description

      I created a small object called Bug with a public String called bugString.
      My object also has a private method called getBugString() which modifies the value of bugString.

      Since Groovy generates properties automatically we now have a public getBugString method and a private one.

      When calling bug.bugString the private getter method is executed outside the scope of the class.

      When serializing the bug object the correct value is returned (as it should)

      I've attached sample code demonstrating the problem.

      Attachments

        Activity

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

          People

            Unassigned Unassigned
            mataniko Matan Bareket
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment