Class UnsafeAccessibleObject
java.lang.Object
dev.derklaro.reflexion.internal.unsafe.UnsafeAccessibleObject
A internal helper class which allows to set the
override boolean in the AccessibleObject class. This can only
be used if the unsafe access is available and the offset of the boolean could get resolved. To verify that this util
is ready to be used, use the isAvailable() method.- Since:
- 1.6
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanChecks if the offset of the override field in AccessibleObject could get resolved and can be used to override the field when callingmakeAccessible(AccessibleObject).static voidmakeAccessible(@NotNull AccessibleObject accessibleObject) Makes the given accessible object accessible.
-
Field Details
-
ACCESSIBLE_OFFSET
private static final long ACCESSIBLE_OFFSET -
SOME_FIELD
-
-
Constructor Details
-
UnsafeAccessibleObject
private UnsafeAccessibleObject()
-
-
Method Details
-
isAvailable
public static boolean isAvailable()Checks if the offset of the override field in AccessibleObject could get resolved and can be used to override the field when callingmakeAccessible(AccessibleObject).- Returns:
- true if this instance can force-set an object accessible, false otherwise.
-
makeAccessible
Makes the given accessible object accessible.- Parameters:
accessibleObject- the object to make accessible.- Throws:
NullPointerException- if the given accessible object is null.IllegalStateException- if this util is not available for usage.
-