Wrong overloaded Java method called when both int and float signatures exist
----------------------------------------------------------------------------
Key: JRUBY-2867
URL: http://jira.codehaus.org/browse/JRUBY-2867
Project: JRuby
Issue Type: Bug
Components: Java Integration
Affects Versions: JRuby 1.1.4
Environment: Windows XP
Reporter: Rod Cope
Priority: Critical
Fix For: JRuby 1.1.4
When calling an overloaded method on a Java class with both int and float
signatures, JRuby trunk (as of 7293) always chooses to call the float version.
JRuby 1.1.3 chooses properly.
Test.java:
package com.openlogic;
public class Test {
public static String doIt(int a) {
return "integer: " + a;
}
public static String doIt(float a) {
return "float: " + a;
}
}
test.rb:
include Java
require 'Test.jar'
Test = com.openlogic.Test
puts Test.doIt(3)
puts Test.doIt(4.5)
Results with jruby 1.1.3:
integer: 3
float: 4.5
Results with jruby-trunk (revision 7293):
float: 3.0
float: 4.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