diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index ee3da58e2dd..7fc31c63b56 100644 --- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -8188,19 +8188,18 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum")); * filter function and the target var handle is then called on the modified (usually shortened) * coordinate list. *
- * If {@code R} is the return type of the filter (which cannot be void), the target var handle must accept a value of - * type {@code R} as its coordinate in position {@code pos}, preceded and/or followed by - * any coordinate not passed to the filter. - * No coordinates are reordered, and the result returned from the filter - * replaces (in order) the whole subsequence of coordinates originally - * passed to the adapter. - *
- * The argument types (if any) of the filter - * replace zero or one coordinate types of the target var handle, at position {@code pos}, - * in the resulting adapted var handle. - * The return type of the filter must be identical to the - * coordinate type of the target var handle at position {@code pos}, and that target var handle - * coordinate is supplied by the return value of the filter. + * If {@code R} is the return type of the filter, then: + *
* If any of the filters throws a checked exception when invoked, the resulting var handle will
* throw an {@link IllegalStateException}.
@@ -8209,12 +8208,12 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* atomic access guarantees as those featured by the target var handle.
*
* @param target the var handle to invoke after the coordinates have been filtered
- * @param pos the position of the coordinate to be filtered
+ * @param pos the position in the coordinate list of the target var handle where the filter is to be inserted
* @param filter the filter method handle
* @return an adapter var handle which filters the incoming coordinate values,
* before calling the target var handle
* @throws IllegalArgumentException if the return type of {@code filter}
- * is void, or it is not the same as the {@code pos} coordinate of the target var handle,
+ * is not void, and it is not the same as the {@code pos} coordinate of the target var handle,
* if {@code pos} is not between 0 and the target var handle coordinate arity, inclusive,
* if the resulting var handle's type would have too many coordinates,
* or if it's determined that {@code filter} throws any checked exceptions.
diff --git a/src/java.base/share/classes/java/lang/invoke/VarHandles.java b/src/java.base/share/classes/java/lang/invoke/VarHandles.java
index a8bc817a9e7..13993ca8f10 100644
--- a/src/java.base/share/classes/java/lang/invoke/VarHandles.java
+++ b/src/java.base/share/classes/java/lang/invoke/VarHandles.java
@@ -563,14 +563,14 @@ final class VarHandles {
List