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

MetaClassImpl invokes call() on binding variable even if it is not a Closure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.6.4
    • None
    • None
    • None

    Description

      The following:

      foo = 5
      foo()
      

      results in:

      Caught: groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.call() is applicable for argument types: () values: []
      	at MyScript.run(MyScript.groovy:2)
      

      This is bad for at least two reasons:

      • The error message is hard to understand (should be: No signature of method: MyScript.foo() is applicable for argument types: () values: [])
      • invokeMethod and methodMissing don't get a chance to intercept the method call

      Likely solution: Change line 1093 of MetaClassImpl.java to: if(bindingVar instanceof Closure) {

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              pniederw Peter Niederwieser
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: