--- a/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/StandardOperation.java Fri Oct 28 16:52:20 2016 +0200
+++ b/nashorn/src/jdk.dynalink/share/classes/jdk/dynalink/StandardOperation.java Tue Nov 01 15:31:44 2016 +0100
@@ -84,79 +84,40 @@
package jdk.dynalink;
/**
- * Defines the standard dynamic operations. Getter and setter operations defined
- * in this enumeration can be composed into a {@link CompositeOperation}, and
- * {@link NamedOperation} can be used to bind the name parameter of operations
- * that take one, in which case it disappears from the type signature.
+ * Defines the standard dynamic operations. The operations {@link #GET} and {@link #SET} must
+ * be used as part of a {@link NamespaceOperation}. {@link NamedOperation} can then be further used on these
+ * {@link NamespaceOperation}s to bind the name parameter of {@link #GET} and {@link #SET} operations, in which case it
+ * disappears from their type signature.
+ * {@link NamedOperation} can also be used to decorate {@link #CALL} and {@link #NEW} operations with a
+ * diagnostic name, and as such it does not affect their type signature.
*/
public enum StandardOperation implements Operation {
/**
- * Get the value of a property defined on an object. Call sites with this
+ * Get the value from a namespace defined on an object. Call sites with this
* operation should have a signature of
- * <tt>(receiver, propertyName)→value</tt> or
+ * <tt>(receiver, name)→value</tt> or
* <tt>(receiver)→value</tt> when used with {@link NamedOperation}, with
* all parameters and return type being of any type (either primitive or
- * reference).
+ * reference). This operation must always be used as part of a {@link NamespaceOperation}.
*/
- GET_PROPERTY,
- /**
- * Set the value of a property defined on an object. Call sites with this
- * operation should have a signature of
- * <tt>(receiver, propertyName, value)→void</tt> or
- * <tt>(receiver, value)→void</tt> when used with {@link NamedOperation},
- * with all parameters and return type being of any type (either primitive
- * or reference).
- */
- SET_PROPERTY,
+ GET,
/**
- * Get the value of an element of a collection. Call sites with this
+ * Set the value in a namespace defined on an object. Call sites with this
* operation should have a signature of
- * <tt>(receiver, index)→value</tt> or
- * <tt>(receiver)→value</tt> when used with {@link NamedOperation}, with
- * all parameters and return type being of any type (either primitive or
- * reference).
- */
- GET_ELEMENT,
- /**
- * Set the value of an element of a collection. Call sites with this
- * operation should have a signature of
- * <tt>(receiver, index, value)→void</tt> or
+ * <tt>(receiver, name, value)→void</tt> or
* <tt>(receiver, value)→void</tt> when used with {@link NamedOperation},
* with all parameters and return type being of any type (either primitive
- * or reference).
+ * or reference). This operation must always be used as part of a {@link NamespaceOperation}.
*/
- SET_ELEMENT,
- /**
- * Get the length of an array or size of a collection. Call sites with
- * this operation should have a signature of <tt>(receiver)→value</tt>,
- * with all parameters and return type being of any type (either primitive
- * or reference).
- */
- GET_LENGTH,
+ SET,
/**
- * Gets an object representing a method defined on an object. Call sites
- * with this operation should have a signature of
- * <tt>(receiver, methodName)→value</tt>, or
- * <tt>(receiver)→value</tt> when used with {@link NamedOperation}
- * with all parameters and return type being of any type (either primitive
- * or reference).
- */
- GET_METHOD,
- /**
- * Calls a method defined on an object. Call sites with this
- * operation should have a signature of
- * <tt>(receiver, methodName, arguments...)→value</tt> or
- * <tt>(receiver, arguments...)→value</tt> when used with {@link NamedOperation},
- * with all parameters and return type being of any type (either primitive
- * or reference).
- */
- CALL_METHOD,
- /**
- * Calls a callable object. Call sites with this operation should have a
- * signature of <tt>(receiver, arguments...)→value</tt>, with all
- * parameters and return type being of any type (either primitive or
- * reference). Typically, if the callable is a method of an object, the
- * first argument will act as the "this" value passed to the called method.
+ * Call a callable object. Call sites with this operation should have a
+ * signature of <tt>(callable, receiver, arguments...)→value</tt>,
+ * with all parameters and return type being of any type (either primitive or
+ * reference). Typically, the callables are presumed to be methods of an object, so
+ * an explicit receiver value is always passed to the callable before the arguments.
+ * If a callable has no concept of a receiver, it is free to ignore the value of the
+ * receiver argument.
* The <tt>CALL</tt> operation is allowed to be used with a
* {@link NamedOperation} even though it does not take a name. Using it with
* a named operation won't affect its signature; the name is solely meant to
@@ -164,8 +125,8 @@
*/
CALL,
/**
- * Calls a constructor object. Call sites with this operation should have a
- * signature of <tt>(receiver, arguments...)→value</tt>, with all
+ * Call a constructor object. Call sites with this operation should have a
+ * signature of <tt>(constructor, arguments...)→value</tt>, with all
* parameters and return type being of any type (either primitive or
* reference). The <tt>NEW</tt> operation is allowed to be used with a
* {@link NamedOperation} even though it does not take a name. Using it with