src/share/classes/java/lang/invoke/MethodHandles.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File jdk Sdiff src/share/classes/java/lang/invoke

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

Print this page
rev 10274 : 8050052: Small cleanups in java.lang.invoke code
Reviewed-by: ?
rev 10275 : imported patch invokers


1940      * <p style="font-size:smaller;">
1941      * <em>Discussion:</em>
1942      * A {@linkplain MethodType#genericMethodType general method type} is one which
1943      * mentions only {@code Object} arguments and return values.
1944      * An invoker for such a type is capable of calling any method handle
1945      * of the same arity as the general type.
1946      * <p style="font-size:smaller;">
1947      * <em>(Note:  The invoker method is not available via the Core Reflection API.
1948      * An attempt to call {@linkplain java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}
1949      * on the declared {@code invokeExact} or {@code invoke} method will raise an
1950      * {@link java.lang.UnsupportedOperationException UnsupportedOperationException}.)</em>
1951      * <p>
1952      * This method throws no reflective or security exceptions.
1953      * @param type the desired target type
1954      * @return a method handle suitable for invoking any method handle convertible to the given type
1955      * @throws IllegalArgumentException if the resulting method handle's type would have
1956      *          <a href="MethodHandle.html#maxarity">too many parameters</a>
1957      */
1958     static public
1959     MethodHandle invoker(MethodType type) {
1960         return type.invokers().generalInvoker();
1961     }
1962 
1963     static /*non-public*/
1964     MethodHandle basicInvoker(MethodType type) {
1965         return type.invokers().basicInvoker();
1966     }
1967 
1968      /// method handle modification (creation from other method handles)
1969 
1970     /**
1971      * Produces a method handle which adapts the type of the
1972      * given method handle to a new type by pairwise argument and return type conversion.
1973      * The original type and new type must have the same number of arguments.
1974      * The resulting method handle is guaranteed to report a type
1975      * which is equal to the desired new type.
1976      * <p>
1977      * If the original type and new type are equal, returns target.
1978      * <p>
1979      * The same conversions are allowed as for {@link MethodHandle#asType MethodHandle.asType},
1980      * and some additional conversions are also applied if those conversions fail.




1940      * <p style="font-size:smaller;">
1941      * <em>Discussion:</em>
1942      * A {@linkplain MethodType#genericMethodType general method type} is one which
1943      * mentions only {@code Object} arguments and return values.
1944      * An invoker for such a type is capable of calling any method handle
1945      * of the same arity as the general type.
1946      * <p style="font-size:smaller;">
1947      * <em>(Note:  The invoker method is not available via the Core Reflection API.
1948      * An attempt to call {@linkplain java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}
1949      * on the declared {@code invokeExact} or {@code invoke} method will raise an
1950      * {@link java.lang.UnsupportedOperationException UnsupportedOperationException}.)</em>
1951      * <p>
1952      * This method throws no reflective or security exceptions.
1953      * @param type the desired target type
1954      * @return a method handle suitable for invoking any method handle convertible to the given type
1955      * @throws IllegalArgumentException if the resulting method handle's type would have
1956      *          <a href="MethodHandle.html#maxarity">too many parameters</a>
1957      */
1958     static public
1959     MethodHandle invoker(MethodType type) {
1960         return type.invokers().genericInvoker();
1961     }
1962 
1963     static /*non-public*/
1964     MethodHandle basicInvoker(MethodType type) {
1965         return type.invokers().basicInvoker();
1966     }
1967 
1968      /// method handle modification (creation from other method handles)
1969 
1970     /**
1971      * Produces a method handle which adapts the type of the
1972      * given method handle to a new type by pairwise argument and return type conversion.
1973      * The original type and new type must have the same number of arguments.
1974      * The resulting method handle is guaranteed to report a type
1975      * which is equal to the desired new type.
1976      * <p>
1977      * If the original type and new type are equal, returns target.
1978      * <p>
1979      * The same conversions are allowed as for {@link MethodHandle#asType MethodHandle.asType},
1980      * and some additional conversions are also applied if those conversions fail.


src/share/classes/java/lang/invoke/MethodHandles.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File