@HashCodeAndEqualsPlugin.Enhance public static class ClassInjector.UsingUnsafe extends ClassInjector.AbstractBase
sun.misc.Unsafe or jdk.internal.misc.Unsafe to inject classes.| Modifier and Type | Class and Description |
|---|---|
protected static interface |
ClassInjector.UsingUnsafe.Dispatcher
A dispatcher for using
sun.misc.Unsafe or jdk.internal.misc.Unsafe. |
static class |
ClassInjector.UsingUnsafe.Factory
A factory for creating a
ClassInjector that uses sun.misc.Unsafe if available but attempts a fallback
to using jdk.internal.misc.Unsafe if the jdk.internal module is not resolved or unavailable. |
protected static interface |
ClassInjector.UsingUnsafe.System
A proxy of
java.lang.System. |
ClassInjector.AbstractBase, ClassInjector.UsingInstrumentation, ClassInjector.UsingJna, ClassInjector.UsingLookup, ClassInjector.UsingReflection, ClassInjector.UsingUnsafe| Modifier and Type | Field and Description |
|---|---|
static String |
SAFE_PROPERTY
If this property is set, Byte Buddy does not make use of any
Unsafe class. |
ALLOW_EXISTING_TYPES, SUPPRESS_ACCESS_CHECKS| Modifier | Constructor and Description |
|---|---|
|
UsingUnsafe(ClassLoader classLoader)
Creates a new unsafe injector for the given class loader with a default protection domain.
|
|
UsingUnsafe(ClassLoader classLoader,
ProtectionDomain protectionDomain)
Creates a new unsafe injector for the given class loader with a default protection domain.
|
protected |
UsingUnsafe(ClassLoader classLoader,
ProtectionDomain protectionDomain,
ClassInjector.UsingUnsafe.Dispatcher.Initializable dispatcher)
Creates a new unsafe injector for the given class loader with a default protection domain.
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,Class<?>> |
injectRaw(Map<? extends String,byte[]> types)
Injects the given types into the represented class loader using a mapping from name to binary representation.
|
boolean |
isAlive()
Indicates if this class injector is available on the current VM.
|
static boolean |
isAvailable()
Checks if unsafe class injection is available on the current VM.
|
static ClassInjector |
ofBootLoader()
Returns an unsafe class injector for the boot class loader.
|
static ClassInjector |
ofPlatformLoader()
Returns an unsafe class injector for the platform class loader.
|
static ClassInjector |
ofSystemLoader()
Returns an unsafe class injector for the system class loader.
|
injectpublic static final String SAFE_PROPERTY
Unsafe class.public UsingUnsafe(@MaybeNull ClassLoader classLoader)
classLoader - The class loader to inject classes into or null for the bootstrap loader.public UsingUnsafe(@MaybeNull ClassLoader classLoader, @MaybeNull ProtectionDomain protectionDomain)
classLoader - The class loader to inject classes into or null for the bootstrap loader.protectionDomain - The protection domain to use or null for no protection domain.protected UsingUnsafe(@MaybeNull ClassLoader classLoader, @MaybeNull ProtectionDomain protectionDomain, ClassInjector.UsingUnsafe.Dispatcher.Initializable dispatcher)
classLoader - The class loader to inject classes into or null for the bootstrap loader.protectionDomain - The protection domain to use or null for no protection domain.dispatcher - The dispatcher to use.public boolean isAlive()
true if this injector is available on the current VM.public Map<String,Class<?>> injectRaw(Map<? extends String,byte[]> types)
types - The types to load via injection.public static boolean isAvailable()
true if unsafe class injection is available on the current VM.public static ClassInjector ofSystemLoader()
public static ClassInjector ofPlatformLoader()
public static ClassInjector ofBootLoader()
Copyright © 2014–2023. All rights reserved.