public class ConstructorHead extends MethodHead
Like HEAD, this injection point can be used to specify
the first instruction in a method, but provides special handling for
constructors. For regular method, the behaviour is identical to HEAD
.
By default, this injection point attempts to select the first instruction after any initialisers (including initialisers merged by mixins) but will fall back to selecting the first instruction after the delegate call (eg. a call to super() or this()) in the case where heuristic detection of the initialisers fails. This behaviour can be overridden by providing the enforce parameter to enforce selection of a specific location.
Example default behaviour:
@At(value = "CTOR_HEAD", unsafe = true)
Example behaviour enforcing post-delegate injection point:
@At(value = "CTOR_HEAD", unsafe = true, args="enforce=POST_DELEGATE")
InjectionPoint.AtCode, InjectionPoint.Flags, InjectionPoint.RestrictTargetLevel, InjectionPoint.Specifier| Modifier and Type | Field and Description |
|---|---|
protected ILogger |
logger
Logger
|
DEFAULT_ALLOWED_SHIFT_BY, MAX_ALLOWED_SHIFT_BY| Constructor and Description |
|---|
ConstructorHead(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
|
checkPriorityaddMessage, after, and, before, getAtCode, getId, getSlice, getSpecifier, getTargetRestriction, nextNode, or, parse, parse, parse, parse, parse, parse, parse, parse, register, register, setTargetRestriction, shift, toStringprotected final ILogger logger
public ConstructorHead(InjectionPointData data)
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 MethodHeaddesc - 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() method