APIdia Launch Partner
Top Constructors Methods
sun.reflect.misc

public final Class ReflectUtil

extends Object
Class Inheritance
Imports
jdk.internal.reflect.Reflection

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static void
ensureMemberAccess(Class<?>
the class performing the access
currentClass
,
Class<?>
the declaring class of the member being accessed
memberClass
,
Object
the target object if accessing instance field or method; or null if accessing static field or method or if target object access rights will be checked later
target
,
int
the member's access modifiers
modifiers
)

Ensures that access to a method or field is granted and throws IllegalAccessException if not.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ReflectUtilback to summary
private ReflectUtil()

Method Detail

ensureMemberAccessback to summary
public static void ensureMemberAccess(Class<?> currentClass, Class<?> memberClass, Object target, int modifiers) throws IllegalAccessException

Ensures that access to a method or field is granted and throws IllegalAccessException if not. This method is not suitable for checking access to constructors.

Implementation Note

Delegates directly to Reflection#ensureMemberAccess(Class, Class, Class, int) which should be used instead.

Parameters
currentClass:Class<?>

the class performing the access

memberClass:Class<?>

the declaring class of the member being accessed

target:Object

the target object if accessing instance field or method; or null if accessing static field or method or if target object access rights will be checked later

modifiers:int

the member's access modifiers

Exceptions
IllegalAccessException:
if access to member is denied