Class Replacements
- java.lang.Object
-
- org.jacoco.core.internal.analysis.filter.Replacements
-
public final class Replacements extends java.lang.ObjectUtility for creating an argument forIFilterOutput.replaceBranches(AbstractInsnNode, Replacements)with information about how to compute the coverage status of branches of instruction from the coverage status of branches of other instructions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReplacements.InstructionBranch
-
Field Summary
Fields Modifier and Type Field Description private java.util.LinkedHashMap<org.objectweb.asm.tree.AbstractInsnNode,java.util.Collection<Replacements.InstructionBranch>>newBranches
-
Constructor Summary
Constructors Constructor Description Replacements()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(org.objectweb.asm.tree.AbstractInsnNode target, org.objectweb.asm.tree.AbstractInsnNode instruction, int branchIndex)Adds branch which has a given target and which should be considered as covered when a branch with a given index of a given instruction is covered.(package private) static ReplacementsignoreDefaultBranch(org.objectweb.asm.tree.AbstractInsnNode switchNode)java.lang.Iterable<java.util.Collection<Replacements.InstructionBranch>>values()
-
-
-
Field Detail
-
newBranches
private final java.util.LinkedHashMap<org.objectweb.asm.tree.AbstractInsnNode,java.util.Collection<Replacements.InstructionBranch>> newBranches
-
-
Method Detail
-
add
public void add(org.objectweb.asm.tree.AbstractInsnNode target, org.objectweb.asm.tree.AbstractInsnNode instruction, int branchIndex)Adds branch which has a given target and which should be considered as covered when a branch with a given index of a given instruction is covered.The branch index should be specified in accordance with the ones assigned by
MethodAnalyzerto a given instruction:- for
TableSwitchInsnNode(and similarly forLookupSwitchInsnNode)- the branch index corresponds to the indexes in the list of unique
labels among
TableSwitchInsnNode.dfltandTableSwitchInsnNode.labels - there are as many branches as unique labels
- branch 0 corresponds to continuation of execution at
TableSwitchInsnNode.dflt
- the branch index corresponds to the indexes in the list of unique
labels among
- for
JumpInsnNodewithOpcodes.GOTOthere is only branch 1 that corresponds to continuation of execution atJumpInsnNode.label - for other
JumpInsnNodethere are two branches- branch 1 corresponds to continuation of execution at
JumpInsnNode.label - branch 0 corresponds to continuation of execution at
AbstractInsnNode.getNext()
- branch 1 corresponds to continuation of execution at
- for instructions with
Opcodes.RETURNandOpcodes.ATHROWthere is only branch 0 that corresponds to exit from the method - there are no branches for instructions whose
AbstractInsnNode.getOpcode()is -1 - for other instructions there is only branch 0 that corresponds to
continuation of execution at
AbstractInsnNode.getNext()
- Parameters:
target- instruction uniquely identifying new branch, e.g. its targetinstruction- instruction whose branch execution status should be usedbranchIndex- index of branch whose execution status should be used
- for
-
values
public java.lang.Iterable<java.util.Collection<Replacements.InstructionBranch>> values()
- Returns:
- the accumulated information in the order of
additions
-
ignoreDefaultBranch
static Replacements ignoreDefaultBranch(org.objectweb.asm.tree.AbstractInsnNode switchNode)
- Returns:
- information about how to compute coverage status of branches of a
given
TableSwitchInsnNodeorLookupSwitchInsnNodein order to ignore itsTableSwitchInsnNode.dfltorLookupSwitchInsnNode.dflt
-
-