public abstract class AbstractWovenProxyAdapter
extends org.objectweb.asm.ClassVisitor
implements org.objectweb.asm.Opcodes
WovenProxy
, and have a static initialiser that populates
Method
fields for use with the
InvocationListener
. Known subclasses are WovenProxyAdapter,
used to weave classes being loaded by the framework, and InterfaceCombiningClassAdapter
which is used to dynamically create objects that implement multiple interfacesModifier and Type | Field and Description |
---|---|
protected org.objectweb.asm.Type |
currentMethodDeclaringType |
protected boolean |
currentMethodDeclaringTypeIsInterface |
static String |
DISPATCHER_FIELD
the name of the field used to store the dispatcher
|
static org.objectweb.asm.Type |
DISPATCHER_TYPE
The ASM type for the dispatcher
|
static boolean |
IS_AT_LEAST_JAVA_6 |
protected boolean |
isSerializable
If we have a no-args constructor then we can delegate there rather than
to a super no-args
|
protected static String |
LISTENER_FIELD
the name of the field used to store the
InvocationListener |
protected List<Class<?>> |
nonObjectSupers
A list of un-woven superclasses between this object and
Object ,
only populated for classes which will directly implement WovenProxy . |
static org.objectweb.asm.Type |
OBJECT_TYPE |
protected Map<String,TypeMethod> |
transformedMethods
Methods we have transformed and need to create static fields for.
|
protected org.objectweb.asm.Type |
typeBeingWoven
The type of this class
|
AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_MANDATED, ACC_MODULE, ACC_NATIVE, ACC_OPEN, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STATIC_PHASE, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_TRANSITIVE, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASM4, ASM5, ASM6, ASM7_EXPERIMENTAL, ASTORE, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DMUL, DNEG, DOUBLE, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F_APPEND, F_CHOP, F_FULL, F_NEW, F_SAME, F_SAME1, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAT, FMUL, FNEG, FREM, FRETURN, FSTORE, FSUB, GETFIELD, GETSTATIC, GOTO, H_GETFIELD, H_GETSTATIC, H_INVOKEINTERFACE, H_INVOKESPECIAL, H_INVOKESTATIC, H_INVOKEVIRTUAL, H_NEWINVOKESPECIAL, H_PUTFIELD, H_PUTSTATIC, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, IMUL, INEG, INSTANCEOF, INTEGER, INVOKEDYNAMIC, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISUB, IUSHR, IXOR, JSR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDIV, LLOAD, LMUL, LNEG, LONG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, NULL, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, TOP, UNINITIALIZED_THIS, V_PREVIEW_EXPERIMENTAL, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V10, V11, V9
Constructor and Description |
---|
AbstractWovenProxyAdapter(org.objectweb.asm.ClassVisitor writer,
String className,
ClassLoader loader)
Create a new adapter for the supplied class
|
Modifier and Type | Method and Description |
---|---|
Set<org.objectweb.asm.commons.Method> |
getKnownMethods() |
static String |
getSanitizedUUIDString()
Get a new UUID suitable for use in method and field names
|
protected abstract org.objectweb.asm.MethodVisitor |
getWeavingMethodVisitor(int access,
String name,
String desc,
String signature,
String[] exceptions,
org.objectweb.asm.commons.Method currentMethod,
String methodStaticFieldName,
org.objectweb.asm.Type currentMethodDeclaringType,
boolean currentMethodDeclaringTypeIsInterface)
Get the
MethodVisitor that will weave a given method |
static void |
readClass(Class<?> c,
org.objectweb.asm.ClassVisitor adapter)
This method will read the bytes for the supplied
Class using the
supplied ASM ClassVisitor , the reader will skip DEBUG, FRAMES and CODE. |
void |
setCurrentMethodDeclaringType(org.objectweb.asm.Type type,
boolean isInterface) |
void |
visit(int version,
int access,
String name,
String signature,
String superName,
String[] interfaces) |
void |
visitEnd()
Our class may claim to implement WovenProxy, but doesn't have any
implementations! We should fix this.
|
org.objectweb.asm.MethodVisitor |
visitMethod(int access,
String name,
String desc,
String signature,
String[] exceptions)
This method is called on each method implemented on this object (but not
for superclass methods) Each of these methods is visited in turn and the
code here generates the byte code for the calls to the InovcationListener
around the existing method
|
protected static final String LISTENER_FIELD
InvocationListener
public static final String DISPATCHER_FIELD
public static final org.objectweb.asm.Type DISPATCHER_TYPE
public static final org.objectweb.asm.Type OBJECT_TYPE
protected final org.objectweb.asm.Type typeBeingWoven
protected final List<Class<?>> nonObjectSupers
Object
,
only populated for classes which will directly implement WovenProxy
.
This list is then used to override any methods that would otherwise be missed
by the weaving process.protected final Map<String,TypeMethod> transformedMethods
TypeMethod
so we know which Class to reflect
them offprotected boolean isSerializable
protected org.objectweb.asm.Type currentMethodDeclaringType
protected boolean currentMethodDeclaringTypeIsInterface
public static final boolean IS_AT_LEAST_JAVA_6
public AbstractWovenProxyAdapter(org.objectweb.asm.ClassVisitor writer, String className, ClassLoader loader)
writer
- The ClassWriter to delegate toclassName
- The name of this classloader
- The ClassLoader loading this classpublic final void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
visit
in class org.objectweb.asm.ClassVisitor
public final org.objectweb.asm.MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)
visitMethod
in class org.objectweb.asm.ClassVisitor
public void visitEnd()
visitEnd
in class org.objectweb.asm.ClassVisitor
public Set<org.objectweb.asm.commons.Method> getKnownMethods()
protected abstract org.objectweb.asm.MethodVisitor getWeavingMethodVisitor(int access, String name, String desc, String signature, String[] exceptions, org.objectweb.asm.commons.Method currentMethod, String methodStaticFieldName, org.objectweb.asm.Type currentMethodDeclaringType, boolean currentMethodDeclaringTypeIsInterface)
MethodVisitor
that will weave a given methodaccess
- name
- desc
- signature
- exceptions
- currentMethod
- methodStaticFieldName
- public static final String getSanitizedUUIDString()
public static void readClass(Class<?> c, org.objectweb.asm.ClassVisitor adapter) throws IOException
Class
using the
supplied ASM ClassVisitor
, the reader will skip DEBUG, FRAMES and CODE.c
- adapter
- IOException
public final void setCurrentMethodDeclaringType(org.objectweb.asm.Type type, boolean isInterface)
Copyright © 2018. All rights reserved.