-
CSR
-
Resolution: Approved
-
P4
-
None
-
None
-
behavioral
-
minimal
-
-
Java API
-
JDK
Summary
Add a new enum value REMOVE
to jdk.dynalink.StandardOperation
to represent removal of a named value from an object's namespace.
Problem
Language implementers have observed that Dynalink does not provide an operation for deleting a property of an object, or a member of a collection, something fairly common in dynamic languages (and distinct from, say, setting a property value to null). Their request to provide REMOVE as a standard operation is quite justified. If Dynalink defined a REMOVE operation, Nashorn's implementation of JavaScript delete
operator would eventually also get reimplemented on top of it.
Solution
Add a new enum value REMOVE
to jdk.dynalink.StandardOperation
.
Additionally, JavaDoc for jdk.dynalink.beans.BeansLinker
class will be updated to describe it is providing default removal behavior for elements of Java Lists and Maps (removal by list index and by map key, respectively). BeansLinker provides common-sense default implementation for all standard operations on Java objects as a fallback when no other language linker provides them, so now it should provide such implementation for REMOVE as well. Since it is not possible to remove properties or methods from a POJO nor elements from an array, the only common-sense default behavior for a REMOVE operations are abovementioned removal of elements from List and Map.
Specification
See the newest attached webrev ZIP file. NB: not submitted as part of the specification is the actual implementation of removal operations provided by BeansLinker
, as they have no publicly visible artifacts except mentioning their existence in the JavaDoc.
- csr of
-
JDK-8191905 Add a REMOVE value to jdk.dynalink.StandardOperation enum
-
- Resolved
-