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

Method dispatch error with @Delegate

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.1.3, 2.2.0-beta-1
    • None
    • None

    Description

      Looks like there is some mix-up of the method parameter 'a' in A.foo() with the field 'a' in class B. In the example below if I rename the method parameter or the field, the code goes through.

      class A {
      	def foo(a){}
      }
      
      class B {
        @Delegate A a = new A()
      }
      
      new B().foo(10)
      

      fails with:

      Caught: groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.foo() is applicable for argument types: (java.lang.Integer) values: [10]
      

      Attachments

        Activity

          People

            paulk Paul King
            roshandawrani Roshan Dawrani
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: