java.security.AccessController
with equal signature.
This can be useful to avoid using types from the java.security
package which were deprecated for removal in Java 17.
Annotated methods are dispatched to the JVM's access controller only if this type is available on the current VM, and if no system
property is added and set to disable such dispatch. In the process, java.security.AccessControlContext
is represented by
Object
.
Modifier and Type | Class and Description |
---|---|
protected static class | AccessControllerPlugin.AccessControlWrapper
An wrapper for a method that represents a method of |
public static @interface | AccessControllerPlugin.Enhance
Indicates that the annotated method represents a pseudo implementation of |
protected abstract static class | AccessControllerPlugin.Initializer
A byte code appender to create an initializer segment that determines if
the |
Modifier and Type | Field and Description |
---|---|
private static final String | ACCESS_CONTROLLER
The binary name of |
private static final Object[] | EMPTY
An empty array to create frames without additional allocation. |
private static final String | NAME
The name of the generated field. |
private final String | property
The property to control if the access controller should be used even
if available or |
private static final Map | SIGNATURES
A map to all signatures of |
Access | Constructor and Description |
---|---|
public | AccessControllerPlugin()
Creates a new plugin to weave access controller dispatches without a property to allow for disabling the access controller handling. |
public | AccessControllerPlugin(String
The property to control if the access controller should be used even
if available or property)null if such a property should not be available.Creates a new plugin to weave access controller dispatches. |
Modifier and Type | Method and Description |
---|---|
public DynamicType. | apply(DynamicType.
The builder to use as a basis for the applied transformation. builder,The type being transformed. typeDescription, ClassFileLocator A class file locator that can locate other types in the scope of the project. classFileLocator)Implements net. |
public void | close()
Implements java. |
public Plugin | make()
Implements net. |
ACCESS_CONTROLLER | back to summary |
---|---|
private static final String ACCESS_CONTROLLER The binary name of |
EMPTY | back to summary |
---|---|
private static final Object[] EMPTY An empty array to create frames without additional allocation. |
NAME | back to summary |
---|---|
private static final String NAME The name of the generated field. |
property | back to summary |
---|---|
private final String property The property to control if the access controller should be used even
if available or |
SIGNATURES | back to summary |
---|---|
private static final Map<MethodDescription. A map to all signatures of |
AccessControllerPlugin | back to summary |
---|---|
public AccessControllerPlugin() Creates a new plugin to weave access controller dispatches without a property to allow for disabling the access controller handling. |
AccessControllerPlugin | back to summary |
---|---|
public AccessControllerPlugin(String property) Creates a new plugin to weave access controller dispatches. |
apply | back to summary |
---|---|
public DynamicType. Implements net. Doc from net. Applies this plugin.
|
close | back to summary |
---|---|
public void close() Implements java. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in |
make | back to summary |
---|---|
public Plugin make() Implements net. Doc from net. Returns a plugin that can be used for a transformation and which is subsequently closed.
|
AccessController
which is weaved.
Modifier and Type | Class and Description |
---|---|
protected static class | AccessControllerPlugin.AccessControlWrapper.PrefixingMethodVisitor
A method visitor to implement a weaved method to dispatch to an |
Access | Constructor and Description |
---|---|
protected |
Modifier and Type | Method and Description |
---|---|
public MethodVisitor | wrap(TypeDescription
The instrumented type. instrumentedType, MethodDescription The method that is currently being defined. instrumentedMethod, MethodVisitor The original field visitor that defines the given method. methodVisitor, Implementation.The implementation context to use. implementationContext,The type pool to use. typePool, int The ASM writerFlags, int net. reader flags to consider.The ASM readerFlags)net. reader flags to consider.Implements net. |
name | back to summary |
---|---|
private final String name The name of the field. |
AccessControlWrapper | back to summary |
---|---|
protected AccessControlWrapper(String name) Creates a new access control wrapper.
|
wrap | back to summary |
---|---|
public MethodVisitor wrap(TypeDescription instrumentedType, MethodDescription instrumentedMethod, MethodVisitor methodVisitor, Implementation. Implements net. Doc from net. Wraps a method visitor.
|
java.security.AccessController
, if available.
Modifier and Type | Field and Description |
---|---|
private final Implementation. | frameGeneration
Indicates the frame generation mode to apply. |
private final TypeDescription | instrumentedType
The instrumented type. |
private final String | name
The name of the field. |
private final int | offset
The base offset of the weaved method. |
private final MethodDescription. | token
The target signature of the method declared by the JVM access controller. |
Access | Constructor and Description |
---|---|
protected | PrefixingMethodVisitor(MethodVisitor
The method visitor to write to. methodVisitor, TypeDescription The instrumented type. instrumentedType, MethodDescription.The target signature of the method declared by the JVM access controller. token,The name of the field. name, int The base offset of the instrumented method. offset, Implementation.Indicates the frame generation mode to apply. frameGenerationCreates a new prefixing method visitor. |
Modifier and Type | Method and Description |
---|---|
public void | visitCode()
Starts the visit of the method's code, if any (i.e. non abstract method).
|
public void | visitMaxs(int
maximum stack size of the method. stackSize, int maximum number of local variables for the method. localVariableLength)
Visits the maximum stack size and the maximum number of local variables of the method.
|
frameGeneration | back to summary |
---|---|
private final Implementation. Indicates the frame generation mode to apply. |
instrumentedType | back to summary |
---|---|
private final TypeDescription instrumentedType The instrumented type. |
name | back to summary |
---|---|
private final String name The name of the field. |
offset | back to summary |
---|---|
private final int offset The base offset of the weaved method. |
token | back to summary |
---|---|
private final MethodDescription. The target signature of the method declared by the JVM access controller. |
PrefixingMethodVisitor | back to summary |
---|---|
protected PrefixingMethodVisitor(MethodVisitor methodVisitor, TypeDescription instrumentedType, MethodDescription. Creates a new prefixing method visitor.
|
visitCode | back to summary |
---|---|
public void visitCode() Overrides net. Doc from net. Starts the visit of the method's code, if any (i.e. non abstract method).
|
visitMaxs | back to summary |
---|---|
public void visitMaxs(int stackSize, int localVariableLength) Overrides net. Doc from net. Visits the maximum stack size and the maximum number of local variables of the method.
|
java.security.AccessController
which can be weaved to dispatch to the access controller if this is possible on the current VM and not explicitly
disabled on the current VM via a system property.
java.security.AccessController
is available.
Modifier and Type | Class and Description |
---|---|
protected static class | AccessControllerPlugin.Initializer.WithoutProperty
An initializer that always uses the access controller if it is available. |
protected static class | AccessControllerPlugin.Initializer.WithProperty
An initializer that uses a property to determine if the access controller should be actually used even if it is available. |
Modifier and Type | Field and Description |
---|---|
private final TypeDescription | instrumentedType
The instrumented type. |
private final String | name
The name of the field to determine the use of access controller dispatch. |
Access | Constructor and Description |
---|---|
protected | Initializer(TypeDescription
The instrumented type. instrumentedType, String The name of the field to determine the use of access controller dispatch. name)Creates a new initializer. |
Modifier and Type | Method and Description |
---|---|
public ByteCodeAppender. | apply(MethodVisitor
The method visitor to which the byte code appender writes its code to. methodVisitor, Implementation.The implementation context of the current type creation process. implementationContext,The method that is the target of the instrumentation. instrumentedMethod)Implements net. |
protected abstract int | Returns: The size of the stack required to implement the implemented dispatch.The method visitor to dispatch to. methodVisitor)Invoked to determine if the access controller should be used after the class was found. |
instrumentedType | back to summary |
---|---|
private final TypeDescription instrumentedType The instrumented type. |
name | back to summary |
---|---|
private final String name The name of the field to determine the use of access controller dispatch. |
Initializer | back to summary |
---|---|
protected Initializer(TypeDescription instrumentedType, String name) Creates a new initializer.
|
apply | back to summary |
---|---|
public ByteCodeAppender. Implements net. Doc from net. Applies this byte code appender to a type creation process.
|
onAccessController | back to summary |
---|---|
protected abstract int onAccessController(MethodVisitor methodVisitor) Invoked to determine if the access controller should be used after the class was found.
|
Access | Constructor and Description |
---|---|
protected | WithoutProperty(TypeDescription
The instrumented type. instrumentedType, String The name of the field to determine the use of access controller dispatch. name)Creates an initializer that always uses the access controller if it is available. |
Modifier and Type | Method and Description |
---|---|
protected int | onAccessController(MethodVisitor
The method visitor to dispatch to. methodVisitor)Implements abstract net. |
WithoutProperty | back to summary |
---|---|
protected WithoutProperty(TypeDescription instrumentedType, String name) Creates an initializer that always uses the access controller if it is available.
|
onAccessController | back to summary |
---|---|
protected int onAccessController(MethodVisitor methodVisitor) Implements abstract net. Doc from net. Invoked to determine if the access controller should be used after the class was found.
|
Modifier and Type | Field and Description |
---|---|
private final String | property
The name of the property. |
Access | Constructor and Description |
---|---|
protected | WithProperty(TypeDescription
The instrumented type. instrumentedType, String The name of the field to determine the use of access controller dispatch. name, String The name of the property. property)Creates an initializer that uses a property to determine if the access controller should be actually used even if it is available. |
Modifier and Type | Method and Description |
---|---|
protected int | onAccessController(MethodVisitor
The method visitor to dispatch to. methodVisitor)Implements abstract net. |
property | back to summary |
---|---|
private final String property The name of the property. |
WithProperty | back to summary |
---|---|
protected WithProperty(TypeDescription instrumentedType, String name, String property) Creates an initializer that uses a property to determine if the access controller should be actually used even if it is available.
|
onAccessController | back to summary |
---|---|
protected int onAccessController(MethodVisitor methodVisitor) Implements abstract net. Doc from net. Invoked to determine if the access controller should be used after the class was found.
|