Package javassist.util.proxy
Class SecurityActions
- java.lang.Object
-
- java.lang.SecurityManager
-
- javassist.util.proxy.SecurityActions
-
class SecurityActions extends java.lang.SecurityManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
SecurityActions.TheUnsafe
_The_ Notorious sun.misc.Unsafe in all its glory, but anonymous so as not to attract unwanted attention.
-
Field Summary
Fields Modifier and Type Field Description static SecurityActions
stack
-
Constructor Summary
Constructors Constructor Description SecurityActions()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static void
disableWarning(SecurityActions.TheUnsafe tu)
Java 9 now complains about every privileged action regardless.java.lang.Class<?>
getCallerClass()
Since Java 9 abruptly removedReflection.getCallerClass()
in favour ofStackWalker
we are left having to find a solution for the older versions without upsetting the new compiler.(package private) static java.lang.reflect.Constructor<?>
getDeclaredConstructor(java.lang.Class<?> clazz, java.lang.Class<?>[] types)
(package private) static java.lang.reflect.Constructor<?>[]
getDeclaredConstructors(java.lang.Class<?> clazz)
(package private) static java.lang.reflect.Method
getDeclaredMethod(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>[] types)
(package private) static java.lang.reflect.Method[]
getDeclaredMethods(java.lang.Class<?> clazz)
(package private) static java.lang.invoke.MethodHandle
getMethodHandle(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>[] params)
(package private) static SecurityActions.TheUnsafe
getSunMiscUnsafeAnonymously()
(package private) static void
set(java.lang.reflect.Field fld, java.lang.Object target, java.lang.Object value)
(package private) static void
setAccessible(java.lang.reflect.AccessibleObject ao, boolean accessible)
-
Methods inherited from class java.lang.SecurityManager
checkAccept, checkAccess, checkAccess, checkConnect, checkConnect, checkCreateClassLoader, checkDelete, checkExec, checkExit, checkLink, checkListen, checkMulticast, checkMulticast, checkPackageAccess, checkPackageDefinition, checkPermission, checkPermission, checkPrintJobAccess, checkPropertiesAccess, checkPropertyAccess, checkRead, checkRead, checkRead, checkSecurityAccess, checkSetFactory, checkWrite, checkWrite, getClassContext, getSecurityContext, getThreadGroup
-
-
-
-
Field Detail
-
stack
public static final SecurityActions stack
-
-
Method Detail
-
getCallerClass
public java.lang.Class<?> getCallerClass()
Since Java 9 abruptly removedReflection.getCallerClass()
in favour ofStackWalker
we are left having to find a solution for the older versions without upsetting the new compiler. The member scoped functiongetClassContext()
available as aSecurityManager
sibling remains functional across all versions, for now.- Returns:
- represents the declaring class of the method that invoked the method that called this or index 2 on the stack trace.
- Since:
- 3.23
-
getDeclaredMethods
static java.lang.reflect.Method[] getDeclaredMethods(java.lang.Class<?> clazz)
-
getDeclaredConstructors
static java.lang.reflect.Constructor<?>[] getDeclaredConstructors(java.lang.Class<?> clazz)
-
getMethodHandle
static java.lang.invoke.MethodHandle getMethodHandle(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>[] params) throws java.lang.NoSuchMethodException
- Throws:
java.lang.NoSuchMethodException
-
getDeclaredMethod
static java.lang.reflect.Method getDeclaredMethod(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>[] types) throws java.lang.NoSuchMethodException
- Throws:
java.lang.NoSuchMethodException
-
getDeclaredConstructor
static java.lang.reflect.Constructor<?> getDeclaredConstructor(java.lang.Class<?> clazz, java.lang.Class<?>[] types) throws java.lang.NoSuchMethodException
- Throws:
java.lang.NoSuchMethodException
-
setAccessible
static void setAccessible(java.lang.reflect.AccessibleObject ao, boolean accessible)
-
set
static void set(java.lang.reflect.Field fld, java.lang.Object target, java.lang.Object value) throws java.lang.IllegalAccessException
- Throws:
java.lang.IllegalAccessException
-
getSunMiscUnsafeAnonymously
static SecurityActions.TheUnsafe getSunMiscUnsafeAnonymously() throws java.lang.ClassNotFoundException
- Throws:
java.lang.ClassNotFoundException
-
disableWarning
static void disableWarning(SecurityActions.TheUnsafe tu)
Java 9 now complains about every privileged action regardless. Displaying warnings of "illegal usage" and then instructing users to go hassle the maintainers in order to have it fixed. Making it hush for now, see all fixed.- Parameters:
tu
- theUnsafe that'll fix it
-
-