src/share/classes/java/lang/invoke/MethodHandle.java

Print this page
rev 10452 : imported patch lang-Typos


 662      * Produces an adapter method handle which adapts the type of the
 663      * current method handle to a new type.
 664      * The resulting method handle is guaranteed to report a type
 665      * which is equal to the desired new type.
 666      * <p>
 667      * If the original type and new type are equal, returns {@code this}.
 668      * <p>
 669      * The new method handle, when invoked, will perform the following
 670      * steps:
 671      * <ul>
 672      * <li>Convert the incoming argument list to match the original
 673      *     method handle's argument list.
 674      * <li>Invoke the original method handle on the converted argument list.
 675      * <li>Convert any result returned by the original method handle
 676      *     to the return type of new method handle.
 677      * </ul>
 678      * <p>
 679      * This method provides the crucial behavioral difference between
 680      * {@link #invokeExact invokeExact} and plain, inexact {@link #invoke invoke}.
 681      * The two methods
 682      * perform the same steps when the caller's type descriptor exactly m atches
 683      * the callee's, but when the types differ, plain {@link #invoke invoke}
 684      * also calls {@code asType} (or some internal equivalent) in order
 685      * to match up the caller's and callee's types.
 686      * <p>
 687      * If the current method is a variable arity method handle
 688      * argument list conversion may involve the conversion and collection
 689      * of several arguments into an array, as
 690      * {@linkplain #asVarargsCollector described elsewhere}.
 691      * In every other case, all conversions are applied <em>pairwise</em>,
 692      * which means that each argument or return value is converted to
 693      * exactly one argument or return value (or no return value).
 694      * The applied conversions are defined by consulting the
 695      * the corresponding component types of the old and new
 696      * method handle types.
 697      * <p>
 698      * Let <em>T0</em> and <em>T1</em> be corresponding new and old parameter types,
 699      * or old and new return types.  Specifically, for some valid index {@code i}, let
 700      * <em>T0</em>{@code =newType.parameterType(i)} and <em>T1</em>{@code =this.type().parameterType(i)}.
 701      * Or else, going the other way for return values, let
 702      * <em>T0</em>{@code =this.type().returnType()} and <em>T1</em>{@code =newType.returnType()}.




 662      * Produces an adapter method handle which adapts the type of the
 663      * current method handle to a new type.
 664      * The resulting method handle is guaranteed to report a type
 665      * which is equal to the desired new type.
 666      * <p>
 667      * If the original type and new type are equal, returns {@code this}.
 668      * <p>
 669      * The new method handle, when invoked, will perform the following
 670      * steps:
 671      * <ul>
 672      * <li>Convert the incoming argument list to match the original
 673      *     method handle's argument list.
 674      * <li>Invoke the original method handle on the converted argument list.
 675      * <li>Convert any result returned by the original method handle
 676      *     to the return type of new method handle.
 677      * </ul>
 678      * <p>
 679      * This method provides the crucial behavioral difference between
 680      * {@link #invokeExact invokeExact} and plain, inexact {@link #invoke invoke}.
 681      * The two methods
 682      * perform the same steps when the caller's type descriptor exactly matches
 683      * the callee's, but when the types differ, plain {@link #invoke invoke}
 684      * also calls {@code asType} (or some internal equivalent) in order
 685      * to match up the caller's and callee's types.
 686      * <p>
 687      * If the current method is a variable arity method handle
 688      * argument list conversion may involve the conversion and collection
 689      * of several arguments into an array, as
 690      * {@linkplain #asVarargsCollector described elsewhere}.
 691      * In every other case, all conversions are applied <em>pairwise</em>,
 692      * which means that each argument or return value is converted to
 693      * exactly one argument or return value (or no return value).
 694      * The applied conversions are defined by consulting the
 695      * the corresponding component types of the old and new
 696      * method handle types.
 697      * <p>
 698      * Let <em>T0</em> and <em>T1</em> be corresponding new and old parameter types,
 699      * or old and new return types.  Specifically, for some valid index {@code i}, let
 700      * <em>T0</em>{@code =newType.parameterType(i)} and <em>T1</em>{@code =this.type().parameterType(i)}.
 701      * Or else, going the other way for return values, let
 702      * <em>T0</em>{@code =this.type().returnType()} and <em>T1</em>{@code =newType.returnType()}.