< prev index next >
src/java.base/share/classes/java/lang/invoke/MethodHandle.java
Print this page
*** 884,896 ****
* Before calling the target, the adapter verifies that the array
* contains exactly enough elements to provide a correct argument count
* to the target method handle.
* (The array may also be null when zero elements are required.)
* <p>
! * If, when the adapter is called, the supplied array argument does
! * not have the correct number of elements, the adapter will throw
! * an {@link IllegalArgumentException} instead of invoking the target.
* <p>
* Here are some simple examples of array-spreading method handles:
* <blockquote><pre>{@code
MethodHandle equals = publicLookup()
.findVirtual(String.class, "equals", methodType(boolean.class, Object.class));
--- 884,900 ----
* Before calling the target, the adapter verifies that the array
* contains exactly enough elements to provide a correct argument count
* to the target method handle.
* (The array may also be null when zero elements are required.)
* <p>
! * When the adapter is called, the length of the supplied {@code array}
! * argument is queried as if by {@code array.length} or {@code arraylength}
! * bytecode. If the adapter accepts zero-length trailing array argument,
! * the supplied {@code array} argument can either be a zero-length array or
! * {@code null}; otherwise, the adapter will throw a {@code NullPointerException}
! * if {@code array} is {@code null} and throw an {@link IllegalArgumentException}
! * if {@code array} does not have the correct number of elements.
* <p>
* Here are some simple examples of array-spreading method handles:
* <blockquote><pre>{@code
MethodHandle equals = publicLookup()
.findVirtual(String.class, "equals", methodType(boolean.class, Object.class));
< prev index next >