Package net.bytebuddy.agent.builder
Enum AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe
- java.lang.Object
-
- java.lang.Enum<AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe>
-
- net.bytebuddy.agent.builder.AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe>
,AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader
- Enclosing interface:
- AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader
public static enum AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe extends java.lang.Enum<AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe> implements AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader
A loader that is using unsafe API to load a lambda implementation. The code for loading the class looks similar to the following:Unsafe unsafe = Unsafe.getUnsafe();
Class<?>
lambdaClass = unsafe.defineAnonymousClass(caller.lookupClass(), binaryRepresentation, null); unsafe.ensureClassInitialized(lambdaClass);
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader
AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.Unavailable, AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingMethodHandleLookup, AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe
-
-
Enum Constant Summary
Enum Constants Enum Constant Description JDK_INTERNAL_MISC_UNSAFE
A loader that usesjdk.internal.misc.Unsafe
.SUN_MISC_UNSAFE
A loader that usessun.misc.Unsafe
.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
type
The internal name of the unsafe type.
-
Constructor Summary
Constructors Modifier Constructor Description private
UsingUnsafe(java.lang.String type)
Creates a new loader using unsafe API.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(org.objectweb.asm.MethodVisitor methodVisitor)
Applies this loader.int
getLocalVariableLength()
Returns the local variable length that is required to implement this loader.int
getStackSize()
Returns the stack size that is required to implement this loader.protected java.lang.String
getType()
Returns the internal name of the unsafe type.static AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
JDK_INTERNAL_MISC_UNSAFE
public static final AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe JDK_INTERNAL_MISC_UNSAFE
A loader that usesjdk.internal.misc.Unsafe
.
-
SUN_MISC_UNSAFE
public static final AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe SUN_MISC_UNSAFE
A loader that usessun.misc.Unsafe
.
-
-
Method Detail
-
values
public static AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe c : AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static AgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader.UsingUnsafe valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getType
protected java.lang.String getType()
Returns the internal name of the unsafe type.- Returns:
- The internal name of the unsafe type.
-
apply
public void apply(org.objectweb.asm.MethodVisitor methodVisitor)
Applies this loader.- Specified by:
apply
in interfaceAgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader
- Parameters:
methodVisitor
- The method visitor to use.
-
getStackSize
public int getStackSize()
Returns the stack size that is required to implement this loader.- Specified by:
getStackSize
in interfaceAgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader
- Returns:
- The stack size that is required to implement this loader.
-
getLocalVariableLength
public int getLocalVariableLength()
Returns the local variable length that is required to implement this loader.- Specified by:
getLocalVariableLength
in interfaceAgentBuilder.LambdaInstrumentationStrategy.LambdaMetafactoryFactory.Loader
- Returns:
- The local variable length that is required to implement this loader.
-
-