Class UnsafeAccessibleObject

java.lang.Object
dev.derklaro.reflexion.internal.unsafe.UnsafeAccessibleObject

public final class UnsafeAccessibleObject extends Object
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 Details

    • ACCESSIBLE_OFFSET

      private static final long ACCESSIBLE_OFFSET
    • SOME_FIELD

      private static final Object 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 calling makeAccessible(AccessibleObject).
      Returns:
      true if this instance can force-set an object accessible, false otherwise.
    • makeAccessible

      public static void makeAccessible(@NotNull @NotNull AccessibleObject accessibleObject)
      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.