Bug report: instanceof incompatible with mozilla_compat's importClass

Tal Liron tal.liron at threecrickets.com
Wed Oct 9 20:56:23 PDT 2013


Hm, something very strange is happening, because I'm also unable to 
isolate this exception.

Moreover, the exception is coming from importPackage in mozilla_compat, 
not importClass. However, nowhere am I calling importPackage. Do you 
have any idea what could be causing this oddity?

On 10/10/2013 03:06 AM, A. Sundararajan wrote:
> 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