Map should support hasOwnProperty?

Frantzius, Jörg Joerg.Frantzius at aperto.com
Thu Feb 2 15:28:29 UTC 2017


Hi,

Nashorn’s extensions let Java Map objects behave somewhat like Javascript objects by making its key-values accessible as object properties.

Unfortunately, it seems that hasOwnProperty() is commonly used in Javascript code to iterate the properties of an object, and this doesn’t work on Map objects. Maybe it would be a good idea to also support hasOwnProperty() on Map objects?

Currently it seems impossible to let 3d party Javascript code traverse a a Java object graph with nested Map objects. While I may be able to traverse and convert a Java object graph if it is made from Collections, Arrays and Maps, this will fail as soon as there is a custom Java class involved that has a Map field (that is accessed from Javascript).

Thanks for any thoughts,
Jörg


---

Dipl. Inf. Jörg von Frantzius, Technical Director

E-Mail joerg.frantzius at aperto.com

Phone +49 30 283921-318
Fax +49 30 283921-29

Aperto GmbH – An IBM Company
Chausseestraße 5, D-10115 Berlin
http://www.aperto.com<http://www.aperto.de/>
http://www.facebook.com/aperto
https://www.xing.com/companies/apertoag

HRB 77049 B, AG Berlin Charlottenburg
Geschäftsführer: Dirk Buddensiek, Kai Großmann, Stephan Haagen, Daniel Simon



More information about the nashorn-dev mailing list