assignment to Java::byte[] creates range error for values greater than 127
--------------------------------------------------------------------------

                 Key: JRUBY-5597
                 URL: http://jira.codehaus.org/browse/JRUBY-5597
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.6, JRuby 1.6RC3, JRuby 1.6RC2, JRuby 1.6RC1
         Environment: Windows XP
            Reporter: John Bebbington


In previous versions, the assignement of a Fixnum upto 255 was accepted in 
assignement, since 1.6 this creates a range error.

Not sure if this behaviour is intneded. I can't find any documentation about 
this change. I know that Java::byte is signed -128..127 but sofar when bridging 
Ruby and Java this form of asignment was accepted.

Below : test case is shown.

---------------------

 Welcome to the JRuby IRB Console [1.5.6] 

irb(main):001:0> b = Java::byte[6].new
#<#<Class:01x1b19753>:0x45ce17>
irb(main):002:0> b[0] = 245
245
irb(main):003:0> 



Welcome to the JRuby IRB Console [1.6.0.RC1] 

irb(main):001:0>  b = Java::byte[6].new
#<#<Class:0x101f35e30>:0xaccd65>
irb(main):002:0> b[0] = 245
RangeError: too big for byte: 245
        from org/jruby/java/proxies/ArrayJavaProxy.java:84:in `op_aset'
        from (irb):2:in `evaluate'
        from org/jruby/RubyKernel.java:1091:in `eval'
        from C:/jruby-1.6.0.RC1/lib/ruby/1.8/irb.rb:158:in `eval_input'
        from C:/jruby-1.6.0.RC1/lib/ruby/1.8/irb.rb:271:in `signal_status'
        from C:/jruby-1.6.0.RC1/lib/ruby/1.8/irb.rb:155:in `eval_input'
        from org/jruby/RubyKernel.java:1421:in `loop'
        from org/jruby/RubyKernel.java:1194:in `rbCatch'
        from C:/jruby-1.6.0.RC1/lib/ruby/1.8/irb.rb:154:in `eval_input'
        from C:/jruby-1.6.0.RC1/lib/ruby/1.8/irb.rb:71:in `start'
        from org/jruby/RubyKernel.java:1194:in `rbCatch'
        from C:/jruby-1.6.0.RC1/lib/ruby/1.8/irb.rb:70:in `start'
irb(main):003:0> 






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