Java::JavaLang::ArrayIndexOutOfBoundsException: 2 thrown when calling java method using String... -------------------------------------------------------------------------------------------------
Key: JRUBY-6010 URL: https://jira.codehaus.org/browse/JRUBY-6010 Project: JRuby Issue Type: Bug Components: Java Integration Affects Versions: JRuby 1.6.3 Environment: Ubuntu 11.04 64bit using JRuby 1.6.3 against Java 6 Reporter: Alex Tambellini Priority: Minor I have a method in java with the following method signature: public Set<Blah> getBlahs(Blah firstBlah, Blah secondBlah, int firstInt, int secondInt, String... strings) and I try to call this method from jruby using a single string in the array using the splat operator: array_of_strings = ["blah"] get_blahs(blah, blah, 0, 3, *array_of_strings) It succeeds. If I try to call this method from jruby using multiple strings in the array not using the splat operator: array_of_strings = ["blah", "blah"] get_blahs(blah, blah, 0, 3, chain.to_java(:string)) It succeeds. If I try to call this method from jruby using multiple strings in the array using the splat operator: array_of_strings = ["blah", "blah"] get_blahs(blah, blah, 0, 3, *array_of_strings) It fails with the following stacktrace: Java::JavaLang::ArrayIndexOutOfBoundsException: 2 from org.jruby.java.dispatch.CallableSelector.findCallable(CallableSelector.java:165) from org.jruby.java.dispatch.CallableSelector.findMatchingCallableForArgs(CallableSelector.java:88) from org.jruby.java.dispatch.CallableSelector.matchingCallableArityN(CallableSelector.java:43) from org.jruby.java.invokers.RubyToJavaInvoker.findCallable(RubyToJavaInvoker.java:182) from org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:28) from org.jruby.java.invokers.InstanceMethodInvoker.call(InstanceMethodInvoker.java:97) from org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:101) from org.jruby.RubyClass.finvoke(RubyClass.java:543) from org.jruby.RubyBasicObject.send(RubyBasicObject.java:2787) from org.jruby.RubyKernel.send(RubyKernel.java:2104) from org.jruby.RubyKernel$s$send.call(RubyKernel$s$send.gen:65535) from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:181) from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:69) from org.jruby.ast.CallSpecialArgNode.interpret(CallSpecialArgNode.java:73) from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) from org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112) ... 193 levels... from org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:319) from org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61) from org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:61) from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:312) from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:169) from script.rails.__file__(script/rails:6) from script.rails.load(script/rails) from org.jruby.Ruby.runScript(Ruby.java:671) from org.jruby.Ruby.runNormally(Ruby.java:575) from org.jruby.Ruby.runFromMain(Ruby.java:424) from org.jruby.Main.doRunFromMain(Main.java:278) from org.jruby.Main.internalRun(Main.java:198) from org.jruby.Main.run(Main.java:164) from org.jruby.Main.run(Main.java:148) from org.jruby.util.ShellLauncher$ScriptThreadProcess.run(ShellLauncher.java:140) from java.lang.Thread.run(Thread.java:679) -- This message is automatically generated by JIRA. 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