Bug report: instanceof incompatible with mozilla_compat's importClass

A. Sundararajan sundararajan.athijegannathan at oracle.com
Thu Oct 10 02:47:27 PDT 2013


Hmm.. does not seem to be the case..

I tried this:

load('nashorn:mozilla_compat.js')
load('nashorn:mozilla_compat.js')

importClass(java.io.File)

var x = {}
print(x instanceof File)

- seems fine as well. prints false as expected. May be something else..

PS. importPackage would chain it's own __noSuchProperty__ again - aside 
from inefficiency, I don't see how that would result in error that you 
cited.

-Sundar

On Thursday 10 October 2013 07:33 AM, Tal Liron wrote:
> Hm, would there be any bad consequences to calling 
> load('nashorn:mozilla_compat.js') twice?
>
> On 10/10/2013 01:08 PM, A. Sundararajan wrote:
>> I hope you call load('nashorn:mozilla_compat.js') as a top-level 
>> expression -- and not within a function. Because mozilla_compat.js 
>> assumes it is being evaluated with 'this' as global scope.
>>
>> ReferenceError may be from importPackage -- because importPackage is 
>> the one that installs __noSuchProperty__ hook to the global scope. 
>> That is to make sure unresolved globals are checked for possible 
>> imports.
>



More information about the nashorn-dev mailing list