--- old/src/java.base/share/classes/java/lang/invoke/MethodHandles.java 2017-08-10 13:48:34.047485047 -0700 +++ new/src/java.base/share/classes/java/lang/invoke/MethodHandles.java 2017-08-10 13:48:33.839475949 -0700 @@ -3353,7 +3353,7 @@ * That is, it returns a zero primitive value, a {@code null}, or {@code void}. *

The returned method handle is equivalent to * {@code dropArguments(zero(type.returnType()), 0, type.parameterList())}. - *

+ * * @apiNote Given a predicate and target, a useful "if-then" construct can be produced as * {@code guardWithTest(pred, target, empty(target.type())}. * @param type the type of the desired method handle @@ -3676,7 +3676,7 @@ * Given these assumptions, the result of an invocation of {@code dropArgumentsToMatch} will have the parameter type * list {@code S..., P..., M..., A...}, with the {@code P} and {@code A} types inserted as if by * {@link #dropArguments(MethodHandle, int, Class[])}. - *

+ * * @apiNote * Two method handles whose argument lists are "effectively identical" (i.e., identical in a common prefix) may be * mutually converted to a common type by two calls to {@code dropArgumentsToMatch}, as follows: @@ -4169,7 +4169,7 @@ * position in the parameter list at which folding takes place. The argument controlling this, {@code pos}, is a * zero-based index. The aforementioned method {@link #foldArguments(MethodHandle, MethodHandle)} assumes position * 0. - *

+ * * @apiNote Example: *

{@code
     import static java.lang.invoke.MethodHandles.*;
@@ -4698,7 +4698,7 @@
      * Note that the parameter type lists {@code (V...)} and {@code (A...)} have been expanded
      * to their full length, even though individual clause functions may neglect to take them all.
      * As noted above, missing parameters are filled in as if by {@link #dropArgumentsToMatch}.
-     * 

+ * * @apiNote Example: *

{@code
      * // iterative implementation of the factorial function as a loop handle
@@ -4991,7 +4991,7 @@
      *   return v;
      * }
      * }
- *

+ * * @apiNote Example: *

{@code
      * // implement the zip function for lists as a loop handle
@@ -5010,7 +5010,7 @@
      * assertEquals(zipped, (List) loop.invoke(a.iterator(), b.iterator()));
      * }
* - *

+ * * @apiNote The implementation of this method can be expressed as follows: *

{@code
      * MethodHandle whileLoop(MethodHandle init, MethodHandle pred, MethodHandle body) {
@@ -5104,7 +5104,7 @@
      *   return v;
      * }
      * }
- *

+ * * @apiNote Example: *

{@code
      * // int i = 0; while (i < limit) { ++i; } return i; => limit
@@ -5116,7 +5116,7 @@
      * assertEquals(23, loop.invoke(23));
      * }
* - *

+ * * @apiNote The implementation of this method can be expressed as follows: *

{@code
      * MethodHandle doWhileLoop(MethodHandle init, MethodHandle body, MethodHandle pred) {
@@ -5248,7 +5248,7 @@
      *   return v;
      * }
      * }
- *

+ * * @apiNote Example with a fully conformant body method: *

{@code
      * // String s = "Lambdaman!"; for (int i = 0; i < 13; ++i) { s = "na " + s; } return s;
@@ -5260,7 +5260,7 @@
      * MethodHandle loop = MethodHandles.countedLoop(fit13, start, MH_step);
      * assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("Lambdaman!"));
      * }
- *

+ * * @apiNote Example with the simplest possible body method type, * and passing the number of iterations to the loop invocation: *

{@code
@@ -5273,7 +5273,7 @@
      * MethodHandle loop = MethodHandles.countedLoop(count, start, MH_step);  // (v, i) -> "na " + v
      * assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke(13, "Lambdaman!"));
      * }
- *

+ * * @apiNote Example that treats the number of iterations, string to append to, and string to append * as loop parameters: *

{@code
@@ -5286,7 +5286,7 @@
      * MethodHandle loop = MethodHandles.countedLoop(count, start, MH_step);  // (v, i, _, pre, _) -> pre + " " + v
      * assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke(13, "na", "Lambdaman!"));
      * }
- *

+ * * @apiNote Example that illustrates the usage of {@link #dropArgumentsToMatch(MethodHandle, int, List, int)} * to enforce a loop type: *

{@code
@@ -5301,7 +5301,7 @@
      * MethodHandle loop = MethodHandles.countedLoop(count, start, body);  // (v, i, pre, _, _) -> pre + " " + v
      * assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("na", 13, "Lambdaman!"));
      * }
- *

+ * * @apiNote The implementation of this method can be expressed as follows: *

{@code
      * MethodHandle countedLoop(MethodHandle iterations, MethodHandle init, MethodHandle body) {
@@ -5406,7 +5406,6 @@
      * }
      * }
* - *

* @apiNote The implementation of this method can be expressed as follows: *

{@code
      * MethodHandle countedLoop(MethodHandle start, MethodHandle end, MethodHandle init, MethodHandle body) {
@@ -5607,7 +5606,7 @@
      *   return v;
      * }
      * }
- *

+ * * @apiNote Example: *

{@code
      * // get an iterator from a list
@@ -5622,7 +5621,7 @@
      * List reversedList = Arrays.asList("e", "d", "c", "b", "a");
      * assertEquals(reversedList, (List) loop.invoke(list));
      * }
- *

+ * * @apiNote The implementation of this method can be expressed approximately as follows: *

{@code
      * MethodHandle iteratedLoop(MethodHandle iterator, MethodHandle init, MethodHandle body) {