some nashorn testing
    Attila Szegedi 
    attila.szegedi at oracle.com
       
    Tue Jan  8 13:49:15 PST 2013
    
    
  
Hey Marcus and Jim, this is similar to that bug we saw before with array literals in the ternary operator. Something related to codegen's inference of types…
On Jan 8, 2013, at 9:30 PM, Andreas Rieber <rieberandreas at gmail.com> wrote:
> I tried some cases and will go for (Nashorn and Rhino):
> 
>   var array;
>   try {
>     array = new (Java.type("java.lang.Object[]"))(len);
>   } catch (x) {
>     array = [];
>   }
> 
> The catch block works with Rhino but gives with Nashorn:
> 
> Exception in thread "main" java.lang.ClassCastException: Cannot cast jdk.nashorn.internal.objects.NativeArray to [Ljava.lang.Object;
>     at sun.invoke.util.ValueConversions.newClassCastException(ValueConversions.java:461)
>     at sun.invoke.util.ValueConversions.castReference(ValueConversions.java:456)
>     at jdk.nashorn.internal.scripts.Script$main.sprintf(main.js:114)
>     at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:350)
>     at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:310)
>     at jdk.nashorn.internal.objects.NativeFunction.apply(NativeFunction.java:133)
> 
> 
> cheers
> Andreas
> 
    
    
More information about the nashorn-dev
mailing list