|
|
|
[
Permlink
| « Hide
]
Nick Sieger - 03/Jul/07 08:49 AM
I think that normally the logic will work as you describe. Blocks will always get converted into args and passed to java methods. What you found here is actually a missing feature that I didn't get the conversion working with constructors.
But this works:
jruby -e "include Java; java.lang.Thread.new(proc {puts 'hello'}).start"
=> hello
It still seems like it's an issue of not considering an incoming block as an argument for method lookup purposes, at least in this case. Yeah, I saw this myself as I was writing the code. Plain and simple, a block won't be treated as an argument to a constructor. The code path for blocks-as-args-to-constructors was a little bit more ugly to get working than with method invocations.
Nick, is it possible to get closure coercion on constructors working for 1.1?
Punting issues from 1.1 RC2 to 1.1 final.
Fixed with tests. Closure conversion now works for constructors and static methods as well as instance methods.
|
||||||||||||||||||||||||||||||||||||||||||||