jruby casts Integer argument to Long for java method with Integer arg.
----------------------------------------------------------------------

                 Key: JRUBY-2958
                 URL: http://jira.codehaus.org/browse/JRUBY-2958
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.1.4
         Environment: mac os x 10.5
            Reporter: Daniel C. Heidebrecht
         Attachments: type_test.rb, TypeTest.jar, TypeTest.java

calling a java method from jruby that expects a java.lang.Integer argument 
results in the following error:

expected [java.lang.Integer]; got: [java.lang.Long]; error: argument type 
mismatch (TypeError)

given the following java method that takes an Integer argument:

public class TypeTest {
    
    private Integer integerProperty;
    
    public void setIntegerProperty(Integer p) {
        integerProperty = p;        
    }

}

and the following ruby code that calls setIntProperty:

require 'java'
require 'TypeTest.jar'
include_class 'TypeTest'

TypeTest.new.setIntegerProperty(6)

error:

type_test.rb:5: for method setIntegerProperty expected [java.lang.Integer]; 
got: [java.lang.Long]; error: argument type mismatch (TypeError)

ruby and java sources attached

-- 
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


Reply via email to