Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.2
-
Fix Version/s: 1.7.3, 1.6.9, 1.8-beta-1
-
Component/s: None
-
Labels:None
-
Environment:Mac OSX 10.6 with Java 1.6
-
Testcase included:yes
-
Number of attachments :
Description
The following code reproduce the error:
class Foo {}
Foo.metaClass.invokeMethod = { String name, args ->
for (arg in args)
}
def f = new Foo()
f.echo(f as Foo)
Activity
Roshan Dawrani
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Attachment | v18x_4241_Patch.txt [ 49456 ] |
Paul King
made changes -
| Comment |
[ Alternative patch - should be run against Roshan's test.
Looks to me like Wrapper could do with some cleanup. Remove all the commented out code which is effectively in the subclasses now and probably remove the protected field too (I suspect no one is using it but to be sure, I would deprecate in 1.7.3 first then remove in 1.8.0). ] |
Paul King
made changes -
| Attachment | v18x_4241B.patch [ 49457 ] |
Roshan Dawrani
made changes -
| Attachment | v2_v18x_4241_Patch.txt [ 49459 ] |
Roshan Dawrani
made changes -
| Assignee | Roshan Dawrani [ roshandawrani ] |
Roshan Dawrani
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Fix Version/s | 1.6.9 [ 16236 ] | |
| Fix Version/s | 1.8-beta-1 [ 16013 ] | |
| Fix Version/s | 1.7.3 [ 16356 ] | |
| Resolution | Fixed [ 1 ] |
Guillaume Laforge
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |
Recording here the issue originally raised by Paulo on the mailing list
class Foo { def echo() { println 10 } } class Bar {} Foo.metaClass.invokeMethod = { String name, args -> for (arg in args) { println arg.getClass() } } def f = new Foo() // This works def bar = [key: 'foo'] as Bar f.echo(bar) // This throws a NullPointerException f.echo([key: 'foo'] as Bar)The example raised in the JIRA is the shortened version of the original issue but I think it's not the same because in my shortened example "asType" call also goes through overridden invokeMethod and since that does not delegate any further to do the actual asType, the shortened version is a little contrived.
So, the real issue to solve is the one here in the comment (raised originally on the mailing list by Paulo).