Daniel Jackson created JRUBY-6562:
-------------------------------------

             Summary: Join fails on fixnum sub-array
                 Key: JRUBY-6562
                 URL: https://jira.codehaus.org/browse/JRUBY-6562
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.6.7, JRuby 1.6.6
         Environment: Fedora 14
jruby 1.6.7 (ruby-1.9.2-p312) (2012-02-22 3e82bc8) (OpenJDK 64-Bit Server VM 
1.6.0_20) [linux-amd64-java]
            Reporter: Daniel Jackson
         Attachments: array_join_fail_example.rb

# When a Fixnum array is created, join works as expected:

a = [1,2,3,4]
a.join('.') -> "1.2.3.4"

# When a sub-list is created from an existing Fixnum array, join fails.

b = a[2,3]
b.join('.') ->
TypeError: can't convert Fixnum into String
        from org/jruby/RubyArray.java:1871:in `join'
        from ...
        from org/jruby/RubyKernel.java:1088:in `eval'
        from org/jruby/RubyKernel.java:1410:in `loop'
        from org/jruby/RubyKernel.java:1197:in `catch'
        from org/jruby/RubyKernel.java:1197:in `catch'
        from ...

This behaviour only occurs in 1.9 compatibility mode, not 1.8.  It occurs in 
both JRuby 1.6.6 and 1.6.7.
Verified expected behaviour in Ruby 1.8.7; 1.9.3; and JRuby 1.6.7 in 1.8 
compatibility mode.

I suspect that the array returned from a subset specification is in some way 
different than a regularly declared array.  I inspected the class and ancestry 
and they look identical, but the behaviour is clearly different.

The line above in RubyArray.java points to  the "join19" method.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.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