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

Method dispatch error with @Delegate

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.3, 2.2.0-beta-1
    • Component/s: None
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: