Groovy
  1. Groovy
  2. GROOVY-3675

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.6.4
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      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) {

        Issue Links

          Activity

          Peter Niederwieser created issue -
          Jochen Theodorou made changes -
          Field Original Value New Value
          Link This issue relates to GROOVY-2503 [ GROOVY-2503 ]
          Peter Niederwieser made changes -
          Assignee Peter Niederwieser [ pniederw ]
          Jochen Theodorou made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Won't Fix [ 2 ]
          Assignee blackdrag blackdrag [ blackdrag ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
          Mark Thomas made changes -
          Workflow jira [ 12732659 ] Default workflow, editable Closed status [ 12744441 ]
          Mark Thomas made changes -
          Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
          Mark Thomas made changes -
          Workflow jira [ 12970393 ] Default workflow, editable Closed status [ 12978159 ]

            People

            • Assignee:
              Jochen Theodorou
              Reporter:
              Peter Niederwieser
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development