protected static enum AgentBuilder.LambdaInstrumentationStrategy.MetaFactoryRedirection extends Enum<AgentBuilder.LambdaInstrumentationStrategy.MetaFactoryRedirection> implements AsmVisitorWrapper.ForDeclaredMethods.MethodVisitorWrapper
public static CallSite metafactory(MethodHandles.Lookup caller,
String invokedName,
MethodType invokedType,
MethodType samMethodType,
MethodHandle implMethod,
MethodType instantiatedMethodType) throws Exception {
Unsafe unsafe = Unsafe.getUnsafe();
Class<?> lambdaClass = unsafe.defineAnonymousClass(caller.lookupClass(),
(byte[]) ClassLoader.getSystemClassLoader().loadClass("net.bytebuddy.agent.builder.LambdaFactory").getDeclaredMethod("make",
Object.class,
String.class,
Object.class,
Object.class,
Object.class,
Object.class,
boolean.class,
List.class,
List.class).invoke(null,
caller,
invokedName,
invokedType,
samMethodType,
implMethod,
instantiatedMethodType,
false,
Collections.emptyList(),
Collections.emptyList()),
null);
unsafe.ensureClassInitialized(lambdaClass);
return invokedType.parameterCount() == 0
? new ConstantCallSite(MethodHandles.constant(invokedType.returnType(), lambdaClass.getDeclaredConstructors()[0].newInstance()))
: new ConstantCallSite(MethodHandles.Lookup.IMPL_LOOKUP.findStatic(lambdaClass, "get$Lambda", invokedType));
| Enum Constant and Description |
|---|
INSTANCE
The singleton instance.
|
| Modifier and Type | Method and Description |
|---|---|
static AgentBuilder.LambdaInstrumentationStrategy.MetaFactoryRedirection |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static AgentBuilder.LambdaInstrumentationStrategy.MetaFactoryRedirection[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
MethodVisitor |
wrap(TypeDescription instrumentedType,
MethodDescription instrumentedMethod,
MethodVisitor methodVisitor,
Implementation.Context implementationContext,
TypePool typePool,
int writerFlags,
int readerFlags)
Wraps a method visitor.
|
public static final AgentBuilder.LambdaInstrumentationStrategy.MetaFactoryRedirection INSTANCE
public static AgentBuilder.LambdaInstrumentationStrategy.MetaFactoryRedirection[] values()
for (AgentBuilder.LambdaInstrumentationStrategy.MetaFactoryRedirection c : AgentBuilder.LambdaInstrumentationStrategy.MetaFactoryRedirection.values()) System.out.println(c);
public static AgentBuilder.LambdaInstrumentationStrategy.MetaFactoryRedirection valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic MethodVisitor wrap(TypeDescription instrumentedType, MethodDescription instrumentedMethod, MethodVisitor methodVisitor, Implementation.Context implementationContext, TypePool typePool, int writerFlags, int readerFlags)
wrap in interface AsmVisitorWrapper.ForDeclaredMethods.MethodVisitorWrapperinstrumentedType - The instrumented type.instrumentedMethod - The method that is currently being defined.methodVisitor - The original field visitor that defines the given method.implementationContext - The implementation context to use.typePool - The type pool to use.writerFlags - The ASM ClassWriter reader flags to consider.readerFlags - The ASM ClassReader reader flags to consider.Copyright © 2014–2019. All rights reserved.