@HashCodeAndEqualsPlugin.Enhance public class AccessControllerPlugin extends Plugin.ForElementMatcher implements Plugin.Factory
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
AccessController which is weaved. |
static interface |
AccessControllerPlugin.Enhance
Indicates that the annotated method represents a pseudo implementation of
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. |
protected static class |
AccessControllerPlugin.Initializer
A byte code appender to create an initializer segment that determines if
the
java.security.AccessController is available. |
Plugin.Factory.Simple, Plugin.Factory.UsingReflection
Plugin.Engine, Plugin.Factory, Plugin.ForElementMatcher, Plugin.NoOp, Plugin.WithInitialization, Plugin.WithPreprocessor
ElementMatcher.Junction<S>
Constructor and Description |
---|
AccessControllerPlugin()
Creates a new plugin to weave access controller dispatches without
a property to allow for disabling the access controller handling.
|
AccessControllerPlugin(String property)
Creates a new plugin to weave access controller dispatches.
|
Modifier and Type | Method and Description |
---|---|
DynamicType.Builder<?> |
apply(DynamicType.Builder<?> builder,
TypeDescription typeDescription,
ClassFileLocator classFileLocator)
Applies this plugin.
|
void |
close() |
Plugin |
make()
Returns a plugin that can be used for a transformation and which is subsequently closed.
|
matches
public AccessControllerPlugin()
@Plugin.Factory.UsingReflection.Priority(value=2147483647) public AccessControllerPlugin(@MaybeNull String property)
property
- The property to control if the access controller should be used even
if available or null
if such a property should not be available.public Plugin make()
make
in interface Plugin.Factory
public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator)
apply
in interface Plugin
builder
- The builder to use as a basis for the applied transformation.typeDescription
- The type being transformed.classFileLocator
- A class file locator that can locate other types in the scope of the project.public void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2014–2024. All rights reserved.