Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.6
    • Fix Version/s: JRuby 1.7.0.pre1
    • Component/s: Java Integration
    • Labels:
      None
    • Environment:
      Mac OSX, Windows 7, Ruby 1.8 and 1.9 mode
    • Number of attachments :
      0

      Description

      I cannot seem to turn Ruby arrays to Java arrays with to_java. It does not appear to recognize the class:

      irb(main):002:0> require 'java'
      => true
      irb(main):003:0> [1, 2].to_java
      => #<#<Class:0x1ae3e881>:0x68b57af1>
      irb(main):004:0> [1, 2].to_java.class
      => #<Class:0x1ae3e881>

      This is not the same output as on the wiki (https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby):
      [1,2,3].to_java
      => [Ljava.lang.Object;@1a32ea4

      I've tried this on 1.6.5.1, 1.6.6, 1.6.7, on windows and mac and it all looks the same...

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        Master has better output for this. It's just a matter of #inspect returning a rather ugly version on 1.6.x. to_s looks like what's on the wiki...perhaps you can update the wiki?

        >> [1, 2].to_java
        => #<#<Class:0x288e85b5>:0x24ec42e0>
        >> [1, 2].to_java.to_s
        => "[Ljava.lang.Object;@174fa0ef"
        
        Show
        Charles Oliver Nutter added a comment - Master has better output for this. It's just a matter of #inspect returning a rather ugly version on 1.6.x. to_s looks like what's on the wiki...perhaps you can update the wiki? >> [1, 2].to_java => #<#<Class:0x288e85b5>:0x24ec42e0> >> [1, 2].to_java.to_s => "[Ljava.lang.Object;@174fa0ef"

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Matt Hauck
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: