protected static enum AgentBuilder.LambdaInstrumentationStrategy.AlternativeMetaFactoryRedirection extends Enum<AgentBuilder.LambdaInstrumentationStrategy.AlternativeMetaFactoryRedirection> implements AsmVisitorWrapper.ForDeclaredMethods.MethodVisitorWrapper
public static CallSite altMetafactory(MethodHandles.Lookup caller,
String invokedName,
MethodType invokedType,
Object... args) throws Exception {
int flags = (Integer) args[3];
int argIndex = 4;
Class<?>[] markerInterface;
if ((flags & FLAG_MARKERS) != 0) {
int markerCount = (Integer) args[argIndex++];
markerInterface = new Class<?>[markerCount];
System.arraycopy(args, argIndex, markerInterface, 0, markerCount);
argIndex += markerCount;
} else {
markerInterface = new Class<?>[0];
}
MethodType[] additionalBridge;
if ((flags & FLAG_BRIDGES) != 0) {
int bridgeCount = (Integer) args[argIndex++];
additionalBridge = new MethodType[bridgeCount];
System.arraycopy(args, argIndex, additionalBridge, 0, bridgeCount);
// argIndex += bridgeCount;
} else {
additionalBridge = new MethodType[0];
}
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,
args[0],
args[1],
args[2],
(flags & FLAG_SERIALIZABLE) != 0,
Arrays.asList(markerInterface),
Arrays.asList(additionalBridge)),
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.AlternativeMetaFactoryRedirection |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static AgentBuilder.LambdaInstrumentationStrategy.AlternativeMetaFactoryRedirection[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
org.objectweb.asm.MethodVisitor |
wrap(TypeDescription instrumentedType,
MethodDescription instrumentedMethod,
org.objectweb.asm.MethodVisitor methodVisitor,
Implementation.Context implementationContext,
TypePool typePool,
int writerFlags,
int readerFlags)
Wraps a method visitor.
|
public static final AgentBuilder.LambdaInstrumentationStrategy.AlternativeMetaFactoryRedirection INSTANCE
public static AgentBuilder.LambdaInstrumentationStrategy.AlternativeMetaFactoryRedirection[] values()
for (AgentBuilder.LambdaInstrumentationStrategy.AlternativeMetaFactoryRedirection c : AgentBuilder.LambdaInstrumentationStrategy.AlternativeMetaFactoryRedirection.values()) System.out.println(c);
public static AgentBuilder.LambdaInstrumentationStrategy.AlternativeMetaFactoryRedirection 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 org.objectweb.asm.MethodVisitor wrap(TypeDescription instrumentedType, MethodDescription instrumentedMethod, org.objectweb.asm.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.