JRuby compiler breaks on array return values --------------------------------------------
Key: JRUBY-4991 URL: http://jira.codehaus.org/browse/JRUBY-4991 Project: JRuby Issue Type: Bug Components: Compiler Affects Versions: JRuby 1.6 Environment: JVM 6 on WinXP Reporter: Ian Dees Attachments: array.patch, wrap.patch Trying to compile the following code with {{jrubyc --javac}}: {noformat} require 'java' class DoubleTest java_signature 'double[] array()' def array [42.0] end end {noformat} ... chokes, because the generated Java code for the return function ends with this: {noformat} return ()ruby_result.toJava(double[].class); {noformat} ... instead of this: {noformat} return (double[])ruby_result.toJava(double[].class); {noformat} There are two issues here. The first is that {{ArrayNodeType}}'s {{getWrapperType()}} isn't returning anything. The attached {{wrap.patch}} fixes the issue. The second issue is that, even with a wrapper type, the generated Java code still fails to compile because it's trying to return a {{Double[]}} as a {{double[]}}. Returning a boxed type from a function declared with a primitive return type appears only to work with scalars. The attached {{array.patch}} changes the Ruby side of the compiler code to use the actual type name instead of the wrapped one--but just for arrays. -- 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