equal
deleted
inserted
replaced
45 * |
45 * |
46 * <h1>Method handle contents</h1> |
46 * <h1>Method handle contents</h1> |
47 * Method handles are dynamically and strongly typed according to their parameter and return types. |
47 * Method handles are dynamically and strongly typed according to their parameter and return types. |
48 * They are not distinguished by the name or the defining class of their underlying methods. |
48 * They are not distinguished by the name or the defining class of their underlying methods. |
49 * A method handle must be invoked using a symbolic type descriptor which matches |
49 * A method handle must be invoked using a symbolic type descriptor which matches |
50 * the method handle's own {@linkplain #type type descriptor}. |
50 * the method handle's own {@linkplain #type() type descriptor}. |
51 * <p> |
51 * <p> |
52 * Every method handle reports its type descriptor via the {@link #type type} accessor. |
52 * Every method handle reports its type descriptor via the {@link #type() type} accessor. |
53 * This type descriptor is a {@link java.lang.invoke.MethodType MethodType} object, |
53 * This type descriptor is a {@link java.lang.invoke.MethodType MethodType} object, |
54 * whose structure is a series of classes, one of which is |
54 * whose structure is a series of classes, one of which is |
55 * the return type of the method (or {@code void.class} if none). |
55 * the return type of the method (or {@code void.class} if none). |
56 * <p> |
56 * <p> |
57 * A method handle's type controls the types of invocations it accepts, |
57 * A method handle's type controls the types of invocations it accepts, |
466 } |
466 } |
467 |
467 |
468 /** |
468 /** |
469 * Invokes the method handle, allowing any caller type descriptor, but requiring an exact type match. |
469 * Invokes the method handle, allowing any caller type descriptor, but requiring an exact type match. |
470 * The symbolic type descriptor at the call site of {@code invokeExact} must |
470 * The symbolic type descriptor at the call site of {@code invokeExact} must |
471 * exactly match this method handle's {@link #type type}. |
471 * exactly match this method handle's {@link #type() type}. |
472 * No conversions are allowed on arguments or return values. |
472 * No conversions are allowed on arguments or return values. |
473 * <p> |
473 * <p> |
474 * When this method is observed via the Core Reflection API, |
474 * When this method is observed via the Core Reflection API, |
475 * it will appear as a single native method, taking an object array and returning an object. |
475 * it will appear as a single native method, taking an object array and returning an object. |
476 * If this native method is invoked directly via |
476 * If this native method is invoked directly via |
487 |
487 |
488 /** |
488 /** |
489 * Invokes the method handle, allowing any caller type descriptor, |
489 * Invokes the method handle, allowing any caller type descriptor, |
490 * and optionally performing conversions on arguments and return values. |
490 * and optionally performing conversions on arguments and return values. |
491 * <p> |
491 * <p> |
492 * If the call site's symbolic type descriptor exactly matches this method handle's {@link #type type}, |
492 * If the call site's symbolic type descriptor exactly matches this method handle's {@link #type() type}, |
493 * the call proceeds as if by {@link #invokeExact invokeExact}. |
493 * the call proceeds as if by {@link #invokeExact invokeExact}. |
494 * <p> |
494 * <p> |
495 * Otherwise, the call proceeds as if this method handle were first |
495 * Otherwise, the call proceeds as if this method handle were first |
496 * adjusted by calling {@link #asType asType} to adjust this method handle |
496 * adjusted by calling {@link #asType asType} to adjust this method handle |
497 * to the required type, and then the call proceeds as if by |
497 * to the required type, and then the call proceeds as if by |