What about JSObject? Object.prototype.hasOwnProperty.call(obj, prop)

Art Fiedler artfiedler at gmail.com
Fri Nov 18 20:58:35 UTC 2016

In UglifyJS2 they use Object.prototype.hasOwnProperty.call(obj, prop) to
determine if the object has that property defined, others like LessCss use
obj.hasOwnProperty(prop) so I was previously able to avoid implementing
JSObject and just add a hasOwnProperty method onto my POJO... but in
UglifyJS2 they use a for(i in obj) and the prototype call so I figured I
had to implement JSObject now I did and ended up finding...

jdk.nashorn.internal.objects.NativeObject.hasOwnProperty(self, v) only
accepts a ScriptObject or a wrapped Boolean, Number, Object[], double[],
int[], or ArrayData... My guess is this should also support

Searching through NativeObject.java I actually don't find a single
reference of JSObject it maybe possible there are a few other area's
needing JSObject support.


More information about the nashorn-dev mailing list