public abstract class ClassInstrumentor extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
ClassInstrumentor.Decorator |
Modifier | Constructor and Description |
---|---|
protected |
ClassInstrumentor(ClassInstrumentor.Decorator decorator) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addDirectCallConstructor(MutableClass mutableClass) |
MutableClass |
analyzeClass(byte[] origClassBytes,
InstrumentationConfiguration config,
ClassNodeProvider classNodeProvider) |
protected String[] |
exceptionArray(org.objectweb.asm.tree.MethodNode method) |
protected abstract void |
generateClassHandlerCall(MutableClass mutableClass,
org.objectweb.asm.tree.MethodNode originalMethod,
String originalMethodName,
RobolectricGeneratorAdapter generator) |
byte[] |
instrument(byte[] origBytes,
InstrumentationConfiguration config,
ClassNodeProvider classNodeProvider) |
void |
instrument(MutableClass mutableClass) |
protected void |
instrumentNativeMethod(MutableClass mutableClass,
org.objectweb.asm.tree.MethodNode method)
Creates native stub which returns the default return value.
|
protected void |
instrumentNormalMethod(MutableClass mutableClass,
org.objectweb.asm.tree.MethodNode method)
Rename the method from
methodName to $$robo$$methodName . |
protected abstract void |
interceptInvokeVirtualMethod(MutableClass mutableClass,
ListIterator<org.objectweb.asm.tree.AbstractInsnNode> instructions,
org.objectweb.asm.tree.MethodInsnNode targetMethod)
Decides to call through the appropriate method to intercept the method with an INVOKEVIRTUAL Opcode, depending if the invokedynamic bytecode instruction is available (Java 7+).
|
protected void |
makeMethodPrivate(org.objectweb.asm.tree.MethodNode method)
Replaces protected and public class modifiers with private.
|
protected void |
makeMethodPublic(org.objectweb.asm.tree.MethodNode method)
Replaces protected and private method modifiers with public.
|
protected abstract void |
writeCallToInitializing(MutableClass mutableClass,
RobolectricGeneratorAdapter generator) |
protected ClassInstrumentor(ClassInstrumentor.Decorator decorator)
public MutableClass analyzeClass(byte[] origClassBytes, InstrumentationConfiguration config, ClassNodeProvider classNodeProvider)
public byte[] instrument(byte[] origBytes, InstrumentationConfiguration config, ClassNodeProvider classNodeProvider)
public void instrument(MutableClass mutableClass)
protected abstract void addDirectCallConstructor(MutableClass mutableClass)
protected abstract void writeCallToInitializing(MutableClass mutableClass, RobolectricGeneratorAdapter generator)
protected void instrumentNormalMethod(MutableClass mutableClass, org.objectweb.asm.tree.MethodNode method)
methodName
to $$robo$$methodName
.final
modifiers, if present.methodName
which delegates to the ClassHandler
.protected void instrumentNativeMethod(MutableClass mutableClass, org.objectweb.asm.tree.MethodNode method)
Creates native stub which returns the default return value.
mutableClass
- Class to be instrumentedmethod
- Method to be instrumented, must be nativeprotected String[] exceptionArray(org.objectweb.asm.tree.MethodNode method)
protected abstract void interceptInvokeVirtualMethod(MutableClass mutableClass, ListIterator<org.objectweb.asm.tree.AbstractInsnNode> instructions, org.objectweb.asm.tree.MethodInsnNode targetMethod)
Decides to call through the appropriate method to intercept the method with an INVOKEVIRTUAL Opcode, depending if the invokedynamic bytecode instruction is available (Java 7+).
protected void makeMethodPublic(org.objectweb.asm.tree.MethodNode method)
Replaces protected and private method modifiers with public.
protected void makeMethodPrivate(org.objectweb.asm.tree.MethodNode method)
Replaces protected and public class modifiers with private.
protected abstract void generateClassHandlerCall(MutableClass mutableClass, org.objectweb.asm.tree.MethodNode originalMethod, String originalMethodName, RobolectricGeneratorAdapter generator)