RubyArray doesn't have toJava method which makes JavaEmbedUtils.rubyToJava fail
-------------------------------------------------------------------------------

                 Key: JRUBY-4515
                 URL: http://jira.codehaus.org/browse/JRUBY-4515
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.5
            Reporter: Yoko Harada
         Attachments: RubyArray.patch, RubyArrayToJavaSample.java

Since RubyArray doesn't have toJava() method, RubyBasicObject.toJava() is used 
when JavaEmbedUtils.rubyToJava() method is called against RubyArray. If target 
type is java.util.List, the conversion has been successfully performed. 
However, when String[] is the target type, conversion fails and RubyArray is 
returned without any conversion.

Attached patch resolves the problem and returns correct type for both String[] 
and List.

Charlie told me on IRC that KernalJavaAddons.to_java was the answer, but for 
some reasons, the method could not be used in RubyArray. Instead, I defined new 
toJava() method. This is similar to JavaClass.javaArrayFromRubyArray(), but a 
specific target type can be applied to conversion.

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