Skip to content

ArrayIndexOutOfBoundsException when calling super of Java class #2923

@yamam

Description

@yamam

I made subclass of VBox(javafx class). In constructor, I call super, and ArrayIndexOutOfBoundsException occurs rarely.

java_import 'javafx.scene.layout.VBox'

class MyVBox < VBox
    def initialize(a)
        super
    end
end

p VBox.new.getClass.getDeclaredConstructors
MyVBox.new(3)

Run above script many times.

for i in {1..100} 
do
  echo $i
  jruby-9.0.0.0.pre2/bin/jruby test.rb
done
1
java.lang.reflect.Constructor[public javafx.scene.layout.VBox(double), public javafx.scene.layout.VBox(javafx.scene.Node[]), public javafx.scene.layout.VBox(double,javafx.scene.Node[]), public javafx.scene.layout.VBox()]@87761d
2
java.lang.reflect.Constructor[public javafx.scene.layout.VBox(double), public javafx.scene.layout.VBox(javafx.scene.Node[]), public javafx.scene.layout.VBox(double,javafx.scene.Node[]), public javafx.scene.layout.VBox()]@87761d
3
java.lang.reflect.Constructor[public javafx.scene.layout.VBox(double), public javafx.scene.layout.VBox(javafx.scene.Node[]), public javafx.scene.layout.VBox(double,javafx.scene.Node[]), public javafx.scene.layout.VBox()]@87761d
4
java.lang.reflect.Constructor[public javafx.scene.layout.VBox(), public javafx.scene.layout.VBox(double), public javafx.scene.layout.VBox(javafx.scene.Node[]), public javafx.scene.layout.VBox(double,javafx.scene.Node[])]@87761d
CallableSelector.java:171:in `findMatchingCallableForArgs': java.lang.ArrayIndexOutOfBoundsException: 1
        from CallableSelector.java:104:in `matchingCallableArityN'
        from Java.java:781:in `call'
        from JavaMethod.java:692:in `call'
        from CachingCallSite.java:273:in `cacheAndCall'
        from CachingCallSite.java:79:in `callBlock'
        from CachingCallSite.java:83:in `call'
        from ConcreteJavaProxy.java:48:in `call'
        from IRRuntimeHelpers.java:891:in `instanceSuper'
        from IRRuntimeHelpers.java:884:in `instanceSuperSplatArgs'
        from test.rb:-1:in `invokeSuper3:initialize'
        from test.rb:5:in `RUBY$method$initialize$1'
        from CompiledIRMethod.java:134:in `call'
        from CachingCallSite.java:323:in `cacheAndCall'
        from CachingCallSite.java:173:in `callBlock'
        from CachingCallSite.java:177:in `call'
        from RubyClass.java:849:in `newInstance'
        from RubyClass$INVOKER$i$newInstance.gen:-1:in `call'
        from JavaMethod.java:312:in `call'
        from ConcreteJavaProxy.java:155:in `call'
        from CachingCallSite.java:313:in `cacheAndCall'
        from CachingCallSite.java:163:in `call'
        from test.rb:-1:in `invokeOther10:new'
        from test.rb:10:in `RUBY$script'
        from null:-1:in `invokeWithArguments'
        from Compiler.java:111:in `load'
        from Ruby.java:830:in `runScript'
        from Ruby.java:823:in `runScript'
        from Ruby.java:753:in `runNormally'
        from Ruby.java:575:in `runFromMain'
        from Main.java:404:in `doRunFromMain'
        from Main.java:299:in `internalRun'
        from Main.java:226:in `run'
        from Main.java:198:in `main'

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions