New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java::JavaLang::ArrayIndexOutOfBoundsException (invalid bucket size: 0) for Set init with empty array & block #5426

Closed
prashantvithani opened this Issue Nov 7, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@prashantvithani
Contributor

prashantvithani commented Nov 7, 2018

Environment

Provide at least:

  • jruby 9.2.1.0 (2.5.0) 2018-11-06 7b14404 OpenJDK 64-Bit Server VM 11+28 on 11+28 [darwin-x86_64]

Expected Behavior

Working fine In 9.2.0.0

jruby-9.2.0.0 :003 > Set.new([]) { |e| e }
 => #<Set: {}> 
jruby-9.2.0.0 :004 >

Actual Behavior

Throwing error Java::JavaLang::ArrayIndexOutOfBoundsException (invalid bucket size: 0) When initializing Set with empty array/set and the block is also given

jruby-9.2.1.0 :009 > Set.new([]) { |x| x }
Traceback (most recent call last):
       16: from org.jruby.ir.interpreter.Interpreter.evalCommon(Interpreter.java:172)
       15: from org.jruby.ir.interpreter.Interpreter.INTERPRET_EVAL(Interpreter.java:118)
       14: from org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
       13: from org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:338)
       12: from org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:187)
       11: from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:180)
       10: from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:355)
        9: from org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)
        8: from org.jruby.RubyClass.newInstance(RubyClass.java:1002)
        7: from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:178)
        6: from org.jruby.ext.set.RubySet$INVOKER$i$initialize.call(RubySet$INVOKER$i$initialize.gen)
        5: from org.jruby.ext.set.RubySet.initialize(RubySet.java:184)
        4: from org.jruby.ext.set.RubySet.initWithEnum(RubySet.java:202)
        3: from org.jruby.ext.set.RubySet.allocHash(RubySet.java:126)
        2: from org.jruby.RubyHash.<init>(RubyHash.java:277)
        1: from org.jruby.RubyHash.allocFirst(RubyHash.java:314)
Java::JavaLang::ArrayIndexOutOfBoundsException (invalid bucket size: 0)
jruby-9.2.1.0 :010 > Set.new([1]) { |x| x }
 => #<Set: {1}> 
jruby-9.2.1.0 :011 > Set.new { |x| x }
 => #<Set: {}> 
jruby-9.2.1.0 :012 > Set.new(Set.new) { |x| x }
Traceback (most recent call last):
       16: from org.jruby.ir.interpreter.Interpreter.evalCommon(Interpreter.java:172)
       15: from org.jruby.ir.interpreter.Interpreter.INTERPRET_EVAL(Interpreter.java:118)
       14: from org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
       13: from org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:338)
       12: from org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:187)
       11: from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:180)
       10: from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:355)
        9: from org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)
        8: from org.jruby.RubyClass.newInstance(RubyClass.java:1002)
        7: from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:178)
        6: from org.jruby.ext.set.RubySet$INVOKER$i$initialize.call(RubySet$INVOKER$i$initialize.gen)
        5: from org.jruby.ext.set.RubySet.initialize(RubySet.java:184)
        4: from org.jruby.ext.set.RubySet.initWithEnum(RubySet.java:211)
        3: from org.jruby.ext.set.RubySet.allocHash(RubySet.java:126)
        2: from org.jruby.RubyHash.<init>(RubyHash.java:277)
        1: from org.jruby.RubyHash.allocFirst(RubyHash.java:314)
Java::JavaLang::ArrayIndexOutOfBoundsException (invalid bucket size: 0)
jruby-9.2.1.0 :013 >

This seems to be because of #5413

@prashantvithani prashantvithani changed the title from Java::JavaLang::ArrayIndexOutOfBoundsException (invalid bucket size: 0) for empty Set init with block to Java::JavaLang::ArrayIndexOutOfBoundsException (invalid bucket size: 0) for Set init with empty array & block Nov 7, 2018

@kares kares added this to the JRuby 9.2.2.0 milestone Nov 7, 2018

@enebo

This comment has been minimized.

Member

enebo commented Nov 7, 2018

doh...I said I fixed #5428 rather than this...Fixed in 1a70f4c

@enebo enebo closed this Nov 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment