Currently method selection uses only a few coarse-grained facts to determine a best match for incoming Ruby values:
- Exact type matches
- Assignability of coercion product
- Implementability of target types
When passing a Fixnum to a method with two overrides, one that takes Object and one that takes Integer, because Fixnum's "natural" Java type is Long, both of these options currently appear to be equally valid. Neither is more exactly matching, and neither is a better assignment target. Because of this, when the Object version comes first in method selection, it may be chosen rather than the Integer version.
This is currently causing two failures on IBM's Java 5 JDK:
Fixing this will require implementing a more complete Java method selection protocol, which should come in JRuby 1.5.