提交 7e1b888d 编写于 作者: R rriggs

8026183: minor documentation problems in java.lang.invoke

8015808: Typo in MethodHandle javadoc
Summary: Fix typos and javadoc markup and extraneous paragraph tags
Reviewed-by: lancea
上级 4e827953
...@@ -124,7 +124,7 @@ public class CallSite { ...@@ -124,7 +124,7 @@ public class CallSite {
* or if the target returned by the hook is not of the given {@code targetType} * or if the target returned by the hook is not of the given {@code targetType}
* @throws NullPointerException if the hook returns a null value * @throws NullPointerException if the hook returns a null value
* @throws ClassCastException if the hook returns something other than a {@code MethodHandle} * @throws ClassCastException if the hook returns something other than a {@code MethodHandle}
* @throws Throwable anything else thrown by the the hook function * @throws Throwable anything else thrown by the hook function
*/ */
/*package-private*/ /*package-private*/
CallSite(MethodType targetType, MethodHandle createTargetHook) throws Throwable { CallSite(MethodType targetType, MethodHandle createTargetHook) throws Throwable {
......
...@@ -75,7 +75,7 @@ public class ConstantCallSite extends CallSite { ...@@ -75,7 +75,7 @@ public class ConstantCallSite extends CallSite {
* or if the target returned by the hook is not of the given {@code targetType} * or if the target returned by the hook is not of the given {@code targetType}
* @throws NullPointerException if the hook returns a null value * @throws NullPointerException if the hook returns a null value
* @throws ClassCastException if the hook returns something other than a {@code MethodHandle} * @throws ClassCastException if the hook returns something other than a {@code MethodHandle}
* @throws Throwable anything else thrown by the the hook function * @throws Throwable anything else thrown by the hook function
*/ */
protected ConstantCallSite(MethodType targetType, MethodHandle createTargetHook) throws Throwable { protected ConstantCallSite(MethodType targetType, MethodHandle createTargetHook) throws Throwable {
super(targetType, createTargetHook); super(targetType, createTargetHook);
...@@ -85,7 +85,7 @@ public class ConstantCallSite extends CallSite { ...@@ -85,7 +85,7 @@ public class ConstantCallSite extends CallSite {
/** /**
* Returns the target method of the call site, which behaves * Returns the target method of the call site, which behaves
* like a {@code final} field of the {@code ConstantCallSite}. * like a {@code final} field of the {@code ConstantCallSite}.
* That is, the the target is always the original value passed * That is, the target is always the original value passed
* to the constructor call which created this instance. * to the constructor call which created this instance.
* *
* @return the immutable linkage state of this call site, a constant method handle * @return the immutable linkage state of this call site, a constant method handle
......
...@@ -251,7 +251,7 @@ import java.util.logging.Logger; ...@@ -251,7 +251,7 @@ import java.util.logging.Logger;
* *
* <h1>Usage examples</h1> * <h1>Usage examples</h1>
* Here are some examples of usage: * Here are some examples of usage:
* <p><blockquote><pre>{@code * <blockquote><pre>{@code
Object x, y; String s; int i; Object x, y; String s; int i;
MethodType mt; MethodHandle mh; MethodType mt; MethodHandle mh;
MethodHandles.Lookup lookup = MethodHandles.lookup(); MethodHandles.Lookup lookup = MethodHandles.lookup();
...@@ -608,7 +608,7 @@ public abstract class MethodHandle { ...@@ -608,7 +608,7 @@ public abstract class MethodHandle {
* or forced to null if the return type is void. * or forced to null if the return type is void.
* <p> * <p>
* This call is equivalent to the following code: * This call is equivalent to the following code:
* <p><blockquote><pre>{@code * <blockquote><pre>{@code
* MethodHandle invoker = MethodHandles.spreadInvoker(this.type(), 0); * MethodHandle invoker = MethodHandles.spreadInvoker(this.type(), 0);
* Object result = invoker.invokeExact(this, arguments); * Object result = invoker.invokeExact(this, arguments);
* }</pre></blockquote> * }</pre></blockquote>
...@@ -643,9 +643,9 @@ public abstract class MethodHandle { ...@@ -643,9 +643,9 @@ public abstract class MethodHandle {
* of the argument array. * of the argument array.
* <p> * <p>
* This method is also equivalent to the following code: * This method is also equivalent to the following code:
* <p><blockquote><pre> * <blockquote><pre>{@code
* {@link #invokeWithArguments(Object...) invokeWithArguments}{@code(arguments.toArray())} * invokeWithArguments(arguments.toArray()
* </pre></blockquote> * }</pre></blockquote>
* *
* @param arguments the arguments to pass to the target * @param arguments the arguments to pass to the target
* @return the result returned by the target * @return the result returned by the target
...@@ -1183,7 +1183,7 @@ assertEquals("[three, thee, tee]", Arrays.toString((Object[])ls.get(0))); ...@@ -1183,7 +1183,7 @@ assertEquals("[three, thee, tee]", Arrays.toString((Object[])ls.get(0)));
/** /**
* Makes a <em>fixed arity</em> method handle which is otherwise * Makes a <em>fixed arity</em> method handle which is otherwise
* equivalent to the the current method handle. * equivalent to the current method handle.
* <p> * <p>
* If the current method handle is not of * If the current method handle is not of
* {@linkplain #asVarargsCollector variable arity}, * {@linkplain #asVarargsCollector variable arity},
......
...@@ -748,7 +748,7 @@ public class MethodHandles { ...@@ -748,7 +748,7 @@ public class MethodHandles {
* If the returned method handle is invoked, the method's class will * If the returned method handle is invoked, the method's class will
* be initialized, if it has not already been initialized. * be initialized, if it has not already been initialized.
* <p><b>Example:</b> * <p><b>Example:</b>
* <p><blockquote><pre>{@code * <blockquote><pre>{@code
import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*; import static java.lang.invoke.MethodType.*;
... ...
...@@ -806,7 +806,7 @@ assertEquals("[x, y]", MH_asList.invoke("x", "y").toString()); ...@@ -806,7 +806,7 @@ assertEquals("[x, y]", MH_asList.invoke("x", "y").toString());
* with the same {@code type} argument. * with the same {@code type} argument.
* *
* <b>Example:</b> * <b>Example:</b>
* <p><blockquote><pre>{@code * <blockquote><pre>{@code
import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*; import static java.lang.invoke.MethodType.*;
... ...
...@@ -882,7 +882,7 @@ assertEquals("", (String) MH_newString.invokeExact()); ...@@ -882,7 +882,7 @@ assertEquals("", (String) MH_newString.invokeExact());
* If the returned method handle is invoked, the constructor's class will * If the returned method handle is invoked, the constructor's class will
* be initialized, if it has not already been initialized. * be initialized, if it has not already been initialized.
* <p><b>Example:</b> * <p><b>Example:</b>
* <p><blockquote><pre>{@code * <blockquote><pre>{@code
import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*; import static java.lang.invoke.MethodType.*;
... ...
...@@ -942,7 +942,7 @@ assertEquals("[x, y, z]", pb.command().toString()); ...@@ -942,7 +942,7 @@ assertEquals("[x, y, z]", pb.command().toString());
* in special circumstances. Use {@link #findConstructor findConstructor} * in special circumstances. Use {@link #findConstructor findConstructor}
* to access instance initialization methods in a safe manner.)</em> * to access instance initialization methods in a safe manner.)</em>
* <p><b>Example:</b> * <p><b>Example:</b>
* <p><blockquote><pre>{@code * <blockquote><pre>{@code
import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*; import static java.lang.invoke.MethodType.*;
... ...
...@@ -2223,7 +2223,7 @@ assert((int)twice.invokeExact(21) == 42); ...@@ -2223,7 +2223,7 @@ assert((int)twice.invokeExact(21) == 42);
* they will come after. * they will come after.
* <p> * <p>
* <b>Example:</b> * <b>Example:</b>
* <p><blockquote><pre>{@code * <blockquote><pre>{@code
import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*; import static java.lang.invoke.MethodType.*;
... ...
...@@ -2237,7 +2237,7 @@ assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z")); ...@@ -2237,7 +2237,7 @@ assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z"));
* }</pre></blockquote> * }</pre></blockquote>
* <p> * <p>
* This method is also equivalent to the following code: * This method is also equivalent to the following code:
* <p><blockquote><pre> * <blockquote><pre>
* {@link #dropArguments(MethodHandle,int,Class...) dropArguments}{@code (target, pos, valueTypes.toArray(new Class[0]))} * {@link #dropArguments(MethodHandle,int,Class...) dropArguments}{@code (target, pos, valueTypes.toArray(new Class[0]))}
* </pre></blockquote> * </pre></blockquote>
* @param target the method handle to invoke after the arguments are dropped * @param target the method handle to invoke after the arguments are dropped
...@@ -2281,7 +2281,7 @@ assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z")); ...@@ -2281,7 +2281,7 @@ assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z"));
* they will come after. * they will come after.
* <p> * <p>
* <b>Example:</b> * <b>Example:</b>
* <p><blockquote><pre>{@code * <blockquote><pre>{@code
import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*; import static java.lang.invoke.MethodType.*;
... ...
...@@ -2299,7 +2299,7 @@ assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z")); ...@@ -2299,7 +2299,7 @@ assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z"));
* }</pre></blockquote> * }</pre></blockquote>
* <p> * <p>
* This method is also equivalent to the following code: * This method is also equivalent to the following code:
* <p><blockquote><pre> * <blockquote><pre>
* {@link #dropArguments(MethodHandle,int,List) dropArguments}{@code (target, pos, Arrays.asList(valueTypes))} * {@link #dropArguments(MethodHandle,int,List) dropArguments}{@code (target, pos, Arrays.asList(valueTypes))}
* </pre></blockquote> * </pre></blockquote>
* @param target the method handle to invoke after the arguments are dropped * @param target the method handle to invoke after the arguments are dropped
...@@ -2347,7 +2347,7 @@ assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z")); ...@@ -2347,7 +2347,7 @@ assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z"));
* (null or not) * (null or not)
* which do not correspond to argument positions in the target. * which do not correspond to argument positions in the target.
* <p><b>Example:</b> * <p><b>Example:</b>
* <p><blockquote><pre>{@code * <blockquote><pre>{@code
import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*; import static java.lang.invoke.MethodType.*;
... ...
...@@ -2440,7 +2440,7 @@ assertEquals("XY", (String) f2.invokeExact("x", "y")); // XY ...@@ -2440,7 +2440,7 @@ assertEquals("XY", (String) f2.invokeExact("x", "y")); // XY
* In all cases, {@code pos} must be greater than or equal to zero, and * In all cases, {@code pos} must be greater than or equal to zero, and
* {@code pos} must also be less than or equal to the target's arity. * {@code pos} must also be less than or equal to the target's arity.
* <p><b>Example:</b> * <p><b>Example:</b>
* <p><blockquote><pre>{@code * <blockquote><pre>{@code
import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*; import static java.lang.invoke.MethodType.*;
... ...
...@@ -2545,7 +2545,7 @@ assertEquals("[top, [[up, down, strange], charm], bottom]", ...@@ -2545,7 +2545,7 @@ assertEquals("[top, [[up, down, strange], charm], bottom]",
* The argument type of the filter (if any) must be identical to the * The argument type of the filter (if any) must be identical to the
* return type of the target. * return type of the target.
* <p><b>Example:</b> * <p><b>Example:</b>
* <p><blockquote><pre>{@code * <blockquote><pre>{@code
import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*; import static java.lang.invoke.MethodType.*;
... ...
...@@ -2636,7 +2636,7 @@ System.out.println((int) f0.invokeExact("x", "y")); // 2 ...@@ -2636,7 +2636,7 @@ System.out.println((int) f0.invokeExact("x", "y")); // 2
* arguments will not need to be live on the stack on entry to the * arguments will not need to be live on the stack on entry to the
* target.) * target.)
* <p><b>Example:</b> * <p><b>Example:</b>
* <p><blockquote><pre>{@code * <blockquote><pre>{@code
import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodHandles.*;
import static java.lang.invoke.MethodType.*; import static java.lang.invoke.MethodType.*;
... ...
......
...@@ -137,7 +137,7 @@ class MethodType implements java.io.Serializable { ...@@ -137,7 +137,7 @@ class MethodType implements java.io.Serializable {
/** This number is the maximum arity of a method handle invoker, 253. /** This number is the maximum arity of a method handle invoker, 253.
* It is derived from the absolute JVM-imposed arity by subtracting two, * It is derived from the absolute JVM-imposed arity by subtracting two,
* which are the slots occupied by invoke method handle, and the the * which are the slots occupied by invoke method handle, and the
* target method handle, which are both at the beginning of the argument * target method handle, which are both at the beginning of the argument
* list used to invoke the target method handle. * list used to invoke the target method handle.
* The longest possible invocation will look like * The longest possible invocation will look like
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册