java.lang.invoke.SwitchPoint problem when using invokedynamic

I’m using JRuby 1.7.13 and Java 7 to perform this task. Firstly, I use
“jrubyc” to compile a simple HelloWorld program into a Java class file
“hello.class”. Next, I download the jruby library
“jruby-complete-1.7.13.jar” and execute the following command:

java -cp .:jruby-complete-1.7.13.jar hello

In the case when I disable the invokedynamic when doing the jrubyc, this
above command executes smoothly and prints out “hello, world!” without
problems. But if invokedynamic is enabled, the following exception
occurs:

Exception in thread “main” java.lang.ClassCastException:
java.lang.Integer cannot be cast to java.lang.invoke.SwitchPoint

at
org.jruby.runtime.invokedynamic.InvocationLinker.invocationFallback(InvocationLinker.java:130)

at hello.file(hello.rb:10)

I’m wondering what this “SwitchPoint” is and why it is causing problems.
I’m scanning through the jruby properties and see the following two
parameters that might be relevant:

#invokedynamic.invocation.java=true
#invokedynamic.invocation.switchpoint=true

But I’ve tried various ways attempting to change the value of these two
parameters but couldn’t manage to do it. I’m also not sure if this is
the correct way of fixing the above exception.

If anyone encounters this, please let me know how you work around with
it. I’m sure there’re people who try to compile a Ruby file with the
latest JRuby version.

Isn’t it because invokeddynamic is available for JDK8 and not JDK7?

If you’ve the possibility to upgrade to JDK 1.8.0_11 and report back,
you
might see a different behavior.

Yes I upgrade to JDK 8 and now it runs.

But why is it so? invokedynamic is available in JDK 7 as well. I can
enable invokedynamic in JRuby compiler args and compile it to see
invokedynamic appearing in the class files.

Christian MICHON wrote in post #1155571:

Isn’t it because invokeddynamic is available for JDK8 and not JDK7?

If you’ve the possibility to upgrade to JDK 1.8.0_11 and report back,
you
might see a different behavior.