Class Replacements
java.lang.Object
org.jacoco.core.internal.analysis.filter.Replacements
Utility for creating an argument for
IFilterOutput.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 ClassesModifier and TypeClassDescriptionstatic final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LinkedHashMap<org.objectweb.asm.tree.AbstractInsnNode, Collection<Replacements.InstructionBranch>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(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) values()
-
Field Details
-
newBranches
private final LinkedHashMap<org.objectweb.asm.tree.AbstractInsnNode,Collection<Replacements.InstructionBranch>> newBranches
-
-
Constructor Details
-
Replacements
public Replacements()
-
-
Method Details
-
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
- Returns:
- the accumulated information in the order of
additions
-
ignoreDefaultBranch
- Returns:
- information about how to compute coverage status of branches of a
given
TableSwitchInsnNodeorLookupSwitchInsnNodein order to ignore itsTableSwitchInsnNode.dfltorLookupSwitchInsnNode.dflt
-