java_signature with array return type yields invalid java code
--------------------------------------------------------------

                 Key: JRUBY-4882
                 URL: http://jira.codehaus.org/browse/JRUBY-4882
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.5.1
         Environment: Mac OS X 10.6.3, built-in Apple java install (1.6)
            Reporter: Christon DeWan


I've been unable to define a ruby class which, when converted to java, has 
class method that return native java arrays. {{java_signature}} causes invalid 
code to be generated. See the following:

{noformat}
$ cat foo.rb 
require 'java'

class MyClass
    MY_ARRAY = %w[foo bar baz]

    java_signature 'static String[] myArray()'
    def self.myArray
        MY_ARRAY.to_java(:string)
    end
end


$ jrubyc --javac foo.rb 
Generating Java class MyClass to /private/tmp/MyClass.java
javac  -d /private/tmp -cp /usr/local/jruby/lib/jruby.jar:. 
/private/tmp/MyClass.java
/private/tmp/MyClass.java:73: illegal start of expression
        return ()ruby_result.toJava(String[].class);
                ^
1 error
{noformat}

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