Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.6.4
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
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
- relates to
-
GROOVY-2503
MOP 2.0 design inflluencing issues
-
Activity
blackdrag blackdrag
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Link | This issue relates to GROOVY-2503 [ GROOVY-2503 ] |
Peter Niederwieser
made changes -
| Assignee | Peter Niederwieser [ pniederw ] |
blackdrag blackdrag
made changes -
| Status | Open [ 1 ] | Closed [ 6 ] |
| Assignee | blackdrag blackdrag [ blackdrag ] | |
| Resolution | Won't Fix [ 2 ] |
I just noticed that the logic to call a closure in the binding is duplicated (MetaClassImpl and Script.invokeMethod). Can one of the two occurrences be removed?