Top Inners Fields Constructors Methods
javassist.util.proxy

pack-priv Class SecurityActions

extends SecurityManager
Class Inheritance
Imports
java.lang.invoke.MethodHandle, .MethodHandles, java.lang.reflect.AccessibleObject, .Constructor, .Field, .Method, java.security.AccessController, .PrivilegedAction, .PrivilegedActionException, .PrivilegedExceptionAction, java.util.ArrayList, .Collections, .HashMap, .List, .Map, javassist.bytecode.ClassFile

Deprecated

as a consequence of SecurityManager being deprecated. See corresponding docs for further information.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
SecurityActions.TheUnsafe

_The_ Notorious sun.misc.Unsafe in all its glory, but anonymous so as not to attract unwanted attention.

Field Summary

Modifier and TypeField and Description
public static final SecurityActions
stack

Deprecated as a consequence of SecurityActions being deprecated.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static void
disableWarning(SecurityActions.TheUnsafe
theUnsafe that'll fix it
tu
)

Java 9 now complains about every privileged action regardless.

public Class<?>

Returns:

represents the declaring class of the method that invoked the method that called this or index 2 on the stack trace.
getCallerClass
()

Since Java 9 abruptly removed Reflection.getCallerClass() in favour of StackWalker we are left having to find a solution for the older versions without upsetting the new compiler.

pack-priv static Constructor<?>
getDeclaredConstructor(final Class<?> clazz, final Class<?>[] types)

pack-priv static Constructor<?>[]
pack-priv static Method
getDeclaredMethod(final Class<?> clazz, final String name, final Class<?>[] types)

pack-priv static Method[]
getDeclaredMethods(final Class<?> clazz)

pack-priv static MethodHandle
getMethodHandle(final Class<?> clazz, final String name, final Class<?>[] params)

pack-priv static SecurityActions.TheUnsafe
pack-priv static void
set(final Field fld, final Object target, final Object value)

pack-priv static void
setAccessible(final AccessibleObject ao, final boolean accessible)

Inherited from java.lang.SecurityManager:
checkAcceptcheckAccesscheckAccesscheckConnectcheckConnectcheckCreateClassLoadercheckDeletecheckExeccheckExitcheckLinkcheckListencheckMulticastcheckMulticastcheckPackageAccesscheckPackageDefinitioncheckPermissioncheckPermissioncheckPrintJobAccesscheckPropertiesAccesscheckPropertyAccesscheckReadcheckReadcheckReadcheckSecurityAccesscheckSetFactorycheckWritecheckWritegetClassContextgetSecurityContextgetThreadGroup

Field Detail

stackback to summary
public static final SecurityActions stack

Deprecated

as a consequence of SecurityActions being deprecated. See corresponding docs for further information.

Constructor Detail

SecurityActionsback to summary
pack-priv SecurityActions()

Method Detail

disableWarningback to summary
pack-priv 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:SecurityActions.TheUnsafe

theUnsafe that'll fix it

getCallerClassback to summary
public Class<?> getCallerClass()

Since Java 9 abruptly removed Reflection.getCallerClass() in favour of StackWalker we are left having to find a solution for the older versions without upsetting the new compiler. The member scoped function getClassContext() available as a SecurityManager sibling remains functional across all versions, for now.

Returns:Class<?>

represents the declaring class of the method that invoked the method that called this or index 2 on the stack trace.

Since
3.23
getDeclaredConstructorback to summary
pack-priv static Constructor<?> getDeclaredConstructor(final Class<?> clazz, final Class<?>[] types) throws NoSuchMethodException
getDeclaredConstructorsback to summary
pack-priv static Constructor<?>[] getDeclaredConstructors(final Class<?> clazz)
getDeclaredMethodback to summary
pack-priv static Method getDeclaredMethod(final Class<?> clazz, final String name, final Class<?>[] types) throws NoSuchMethodException
getDeclaredMethodsback to summary
pack-priv static Method[] getDeclaredMethods(final Class<?> clazz)
getMethodHandleback to summary
pack-priv static MethodHandle getMethodHandle(final Class<?> clazz, final String name, final Class<?>[] params) throws NoSuchMethodException
getSunMiscUnsafeAnonymouslyback to summary
pack-priv static SecurityActions.TheUnsafe getSunMiscUnsafeAnonymously() throws ClassNotFoundException
setback to summary
pack-priv static void set(final Field fld, final Object target, final Object value) throws IllegalAccessException
setAccessibleback to summary
pack-priv static void setAccessible(final AccessibleObject ao, final boolean accessible)
javassist.util.proxy back to summary

pack-priv Class SecurityActions.TheUnsafe

extends Object
Class Inheritance

_The_ Notorious sun.misc.Unsafe in all its glory, but anonymous so as not to attract unwanted attention. Kept in two separate parts it manages to avoid detection from linker/compiler/general complainers and those. This functionality will vanish from the JDK soon but in the meantime it shouldn't be an obstacle. All exposed methods are cached in a dictionary with overloaded methods collected under their corresponding keys. Currently the implementation assumes there is only one, if you need find a need there will have to be a compare.
Since
3.23

Field Summary

Modifier and TypeField and Description
pack-priv final Map<String, List<Method>>
pack-priv final Object
pack-priv final Class<?>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Object
call(String name, Object... args)

private Method
getM(String name, Object[] o)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

methodsback to summary
pack-priv final Map<String, List<Method>> methods
theUnsafeback to summary
pack-priv final Object theUnsafe
unsafeback to summary
pack-priv final Class<?> unsafe

Constructor Detail

TheUnsafeback to summary
pack-priv TheUnsafe(Class<?> c, Object o)

Method Detail

callback to summary
public Object call(String name, Object... args)
getMback to summary
private Method getM(String name, Object[] o)