Top Description Fields Constructors Methods
jdk.internal.reflect

public Class AccessorUtils

extends Object
Class Inheritance
Imports
java.lang.invoke.WrongMethodTypeException, java.util.Set

Utility methods used by DirectMethodHandleAccessor and DirectConstructorHandleAccessor

Field Summary

Modifier and TypeField and Description
private static final Set<String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv static boolean
isIllegalArgument(Class<?>
the accessor class that does the method handle invocation
accessorType
,
RuntimeException
ClassCastException, NullPointerException or WrongMethodTypeException
e
)

Determines if the given exception thrown by MethodHandle::invokeExact is caused by an illegal argument passed to Method::invoke or Constructor::newInstance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

IMPL_PACKAGESback to summary
private static final Set<String> IMPL_PACKAGES

Constructor Detail

AccessorUtilsback to summary
public AccessorUtils()

Method Detail

isIllegalArgumentback to summary
pack-priv static boolean isIllegalArgument(Class<?> accessorType, RuntimeException e)

Determines if the given exception thrown by MethodHandle::invokeExact is caused by an illegal argument passed to Method::invoke or Constructor::newInstance. This method inspects the stack trace of the exception to detect if it is thrown by the method handle core implementation or the implementation of the reflected method or constructor. MethodHandle::invoke throws ClassCastException if the receiver object is not an instance of the declaring class of the method if the method is an instance method, or if a parameter value cannot be converted to the corresponding formal parameter type. It throws NullPointerException if the receiver object is null if the method is an instance method, or if unboxing operation of a parameter fails because the parameter value is null. It throws WrongMethodTypeException if the method type mismatches.

Parameters
accessorType:Class<?>

the accessor class that does the method handle invocation

e:RuntimeException

ClassCastException, NullPointerException or WrongMethodTypeException