Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2503 MOP 2.0 design inflluencing issues
  3. GROOVY-6084

Assignment operator does not dispatch to overloaded setter methods

Attach filesAttach ScreenshotVotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.2
    • 2.4.0-beta-4
    • groovy-runtime
    • None

    Description

      If a class has multiple versions of a setter method that each take a different parameter type the assignment operator will always dispatch to the last declared one regardless of the type of the right hand side of the assignment expression. This is also true if the setter methods are added using the meta class.

      A longer explanation with a couple of examples is here: http://blog.freeside.co/post/46597838031/groovy-gotchas-overloading-the-assignment-operator

      Attachments

        Activity

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

          People

            melix Cédric Champeau
            robfletcher Rob Fletcher
            Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment