Java method selection is subject to reflection ordering
-------------------------------------------------------
Key: JRUBY-4107
URL: http://jira.codehaus.org/browse/JRUBY-4107
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.4
Reporter: Charles Oliver Nutter
Assignee: Thomas E Enebo
Fix For: JRuby 1.5
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:
{noformat}
1)
'A Java object's java_method method produces Method for static methods against
an instance' FAILED
expected: #<Java::JavaLang::Integer:0x473e473e>,
got: 1 (using ==)
...
./spec/java_integration/methods/java_method_spec.rb:22:
...
2)
'A Java object's java_method method produces Method for static methods against
a class' FAILED
expected: #<Java::JavaLang::Integer:0x40a640a6>,
got: 1 (using ==)
...
./spec/java_integration/methods/java_method_spec.rb:33:
...
{noformat}
Fixing this will require implementing a more complete Java method selection
protocol, which should come in JRuby 1.5.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email