Although most the time it’s very intuitive (e.g.
sometimes the finest details behind the curtains need real world use-cases to get right.
Mostly due the fact that in Ruby there’s always a single method to call given a name,
while in Java method dispatch accounts for static parameter types.
Add automatic Ruby to Java type conversion on top and things get
ambiguous every so often as JRuby tries to match the right Java method for you.
One such case that needs special care is matching a “proc-to-interface” method when users implement an interface using a Ruby proc/block :
The intent is clearly
listFiles( FileFilter ) as the
(functional) interface requires an
accept(File pathname) that takes a single argument.
But what if the block arity changes :
Turns out Java method matching wasn’t 100% deterministic with ambiguous overloaded methods in general (not just those ending with a proc) and depended on JVM’s reflected method order, thus expect a lot of confusing “warnings” to be ironed out. It’s also why the change is not considered breaking for JRuby 1.7.