< prev index next >
jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
Print this page
*** 2557,2567 ****
* @throws IllegalArgumentException if arrayClass is not an array type
* @since 9
*/
public static
MethodHandle arrayLength(Class<?> arrayClass) throws IllegalArgumentException {
! return MethodHandleImpl.makeArrayElementAccessor(arrayClass, MethodHandleImpl.ArrayAccess.LENGTH);
}
/**
* Produces a method handle giving read access to elements of an array.
* The type of the method handle will have a return type of the array's
--- 2557,2570 ----
* @throws IllegalArgumentException if arrayClass is not an array type
* @since 9
*/
public static
MethodHandle arrayLength(Class<?> arrayClass) throws IllegalArgumentException {
! ValueType<?> compValue = valueComponent(arrayClass);
! return (compValue != null) ?
! compValue.arrayLength() :
! MethodHandleImpl.makeArrayElementAccessor(arrayClass, MethodHandleImpl.ArrayAccess.LENGTH);
}
/**
* Produces a method handle giving read access to elements of an array.
* The type of the method handle will have a return type of the array's
< prev index next >