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

onMethodSelection() doesn't fire when setter is called with property syntax

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.0-beta-1
    • 4.0.0-beta-2
    • Static Type Checker
    • None

    Description

      import groovy.transform.TypeChecked
      
      @TypeChecked
      class MyCar {
          String brand
      }
      
      @TypeChecked(extensions = ["MyChecker.grovy"])
      class MyCarMain {
          static void main(String[] args) {
              def main = new MyCarMain()
              main.configureCar {
                  brand = "BMW"
              }
          }
      
          MyCar configureCar(@DelegatesTo(MyCar) Closure closure) {
              def car = new MyCar()
              closure.delegate = car
              closure.resolveStrategy = Closure.DELEGATE_FIRST
              closure.call()
              car
          }
      }
      

      Same when MyCar declares explicit getter and setter instead of property. Changing to setBrand("BMW") solves the problem.

      Attachments

        Activity

          People

            emilles Eric Milles
            pniederw Peter Niederwieser
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: