Bug report: instanceof incompatible with mozilla_compat's importClass

A. Sundararajan sundararajan.athijegannathan at oracle.com
Wed Oct 9 12:06:44 PDT 2013


     var x  = {}
     load('nashorn:mozilla_compat.js')

     importClass(java.io.File)
     print(x instanceof File)

     var y  =  new File("foo");
     print(y instanceof File)

works fine for me. Tried with latest nashorn tip:

changeset:   596:03a68e7ca1d5
tag:         tip
user:        lagergren
date:        Wed Oct 09 17:53:22 2013 +0200
summary:     8026137: Fix Issues with Binary Evaluation Order


PS. I am sure this should work with early access jdk8 snapshot too -- as 
I don't recall any bugfix in this area in the recent past.

-Sundar

On Wednesday 09 October 2013 08:40 PM, Tal Liron wrote:
> Example:
>
> importClass(java.io.File)
> x instanceof File
>
> Will throw an exception:
>
> nashorn:mozilla_compat.js:65:20 ReferenceError: File is not defined
>     at 
> jdk.nashorn.internal.scripts.Script$\=nashorn\!mozilla_compat._L47$_L51(nashorn:mozilla_compat.js:65)
>
> However, this works:
>
> x instanceof java.io.File
>



More information about the nashorn-dev mailing list