Weird ClassCastException
A. Sundararajan
sundararajan.athijegannathan at oracle.com
Mon Nov 4 23:39:43 PST 2013
No, it is hard to debug with cast issue without access to code.
You may get this sort of cast issue when calling a Java method from
script code. Only possible remedy is to try to call 'exact' method - to
make sure right overload is selected.
java.lang.System.out["println(Object)"]('hello'); // choose exact
overload of println method.
Also, please make sure values passed from script are of either exact
type or convertible automatically to the types required.
-Sundar
On Tuesday 05 November 2013 12:19 PM, Tal Liron wrote:
> A recent Nashorn commit introduced some rather bizarre exceptions.
> Here's how they look:
>
> java.lang.ClassCastException:
> com.threecrickets.scripturian.adapter.NashornAdapter cannot be cast to
> java.lang.Number
> at
> sun.invoke.util.ValueConversions.primitiveConversion(ValueConversions.java:199)
> at
> sun.invoke.util.ValueConversions.unboxBoolean(ValueConversions.java:95)
> at
> jdk.nashorn.internal.scripts.Script$index_s_html.runScript(dispatched/index.s.html:1)
> at
> jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:498)
> at
> jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:207)
> at
> jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:378)
>
> I realize it's hard to debug without the full loop... but perhaps the
> stack trace suggests something to you?
More information about the nashorn-dev
mailing list