Class JumpInsnPoint


  • public class JumpInsnPoint
    extends InjectionPoint

    This injection point searches for JUMP opcodes (if, try/catch, continue, break, conditional assignment, etc.) with either a particular opcode or at a particular ordinal in the method body (eg. "the Nth JUMP insn" where N is the ordinal of the instruction). By default it returns all JUMP instructions in a method body. It accepts the following parameters from At:

    opcode
    The opcode of the jump instruction, must be one of IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL. Defaults to -1 which matches any JUMP opcode.
    ordinal
    The ordinal position of the jump insn to match. For example if there are 3 jumps of the specified type and you want to match the 2nd then you can specify an ordinal of 1 (ordinals are zero-indexed). The default value is -1 which supresses ordinal matching

    Example:

       @At(value = "JUMP", opcode = Opcodes.IFLE, ordinal = 2)

    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.

    • Method Detail

      • find

        public boolean find​(java.lang.String desc,
                            org.objectweb.asm.tree.InsnList insns,
                            java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes)
        Description copied from class: InjectionPoint
        Find injection points in the supplied insn list
        Specified by:
        find in class InjectionPoint
        Parameters:
        desc - Method descriptor, supplied to allow return types and arguments etc. to be determined
        insns - Insn list to search in, the strategy MUST ONLY add nodes from this list to the nodes collection
        nodes - Collection of nodes to populate. Injectors should NOT make any assumptions about the state of this collection and should only call the add() method
        Returns:
        true if one or more injection points were found