public class BeforeNew extends InjectionPoint
This injection point searches for NEW opcodes matching its arguments and
returns a list of insns immediately prior to matching instructions. It
accepts the following parameters from
At:
Examples:
// Find all NEW opcodes for String @At(value = "NEW", args = "class=java/lang/String")
// Find all NEW opcodes for String @At(value = "NEW", target = "java/lang/String"
// Find all NEW opcodes for String which are constructed using the // ctor which takes an array of char @At(value = "NEW", target = "([C)Ljava/lang/String;"
Note that like all standard injection points, this class matches the insn
itself, putting the injection point immediately before the access in
question. Use shift
specifier to adjust the matched opcode as necessary.
InjectionPoint.AtCode, InjectionPoint.RestrictTargetLevel, InjectionPoint.SelectorDEFAULT_ALLOWED_SHIFT_BY, MAX_ALLOWED_SHIFT_BY| Constructor and Description |
|---|
BeforeNew(InjectionPointData data) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
find(java.lang.String desc,
org.objectweb.asm.tree.InsnList insns,
java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes)
Find injection points in the supplied insn list
|
protected boolean |
findCtor(org.objectweb.asm.tree.InsnList insns,
org.objectweb.asm.tree.TypeInsnNode newNode) |
boolean |
hasDescriptor()
Returns whether this injection point has a constructor descriptor defined
|
public BeforeNew(InjectionPointData data)
public boolean hasDescriptor()
public boolean find(java.lang.String desc,
org.objectweb.asm.tree.InsnList insns,
java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes)
InjectionPointfind in class InjectionPointdesc - Method descriptor, supplied to allow return types and
arguments etc. to be determinedinsns - Insn list to search in, the strategy MUST ONLY add nodes
from this list to the nodes collectionnodes - Collection of nodes to populate. Injectors should NOT make
any assumptions about the state of this collection and should only
call the add() methodprotected boolean findCtor(org.objectweb.asm.tree.InsnList insns,
org.objectweb.asm.tree.TypeInsnNode newNode)