Class MethodCoverageCalculator
java.lang.Object
org.jacoco.core.internal.analysis.MethodCoverageCalculator
- All Implemented Interfaces:
IFilterOutput
Calculates the filtered coverage of a single method. A instance of this class
can be first used as
IFilterOutput before the coverage result is
calculated.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Set<org.objectweb.asm.tree.AbstractInsnNode> private final Map<org.objectweb.asm.tree.AbstractInsnNode, Instruction> private final Map<org.objectweb.asm.tree.AbstractInsnNode, org.objectweb.asm.tree.AbstractInsnNode> Instructions that should be merged form disjoint sets.private final Map<org.objectweb.asm.tree.AbstractInsnNode, Set<org.objectweb.asm.tree.AbstractInsnNode>> -
Constructor Summary
ConstructorsConstructorDescriptionMethodCoverageCalculator(Map<org.objectweb.asm.tree.AbstractInsnNode, Instruction> instructions) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate void(package private) voidcalculate(MethodCoverageImpl coverage) Applies all specified filtering commands and calculates the resulting coverage.private voidensureCapacity(MethodCoverageImpl coverage) private org.objectweb.asm.tree.AbstractInsnNodefindRepresentative(org.objectweb.asm.tree.AbstractInsnNode i) voidignore(org.objectweb.asm.tree.AbstractInsnNode fromInclusive, org.objectweb.asm.tree.AbstractInsnNode toInclusive) Marks sequence of instructions that should be ignored during computation of coverage.voidmerge(org.objectweb.asm.tree.AbstractInsnNode i1, org.objectweb.asm.tree.AbstractInsnNode i2) Marks two instructions that should be merged during computation of coverage.voidreplaceBranches(org.objectweb.asm.tree.AbstractInsnNode source, Set<org.objectweb.asm.tree.AbstractInsnNode> newTargets) Marks instruction whose outgoing branches should be replaced during computation of coverage.
-
Field Details
-
instructions
-
ignored
-
merged
private final Map<org.objectweb.asm.tree.AbstractInsnNode, org.objectweb.asm.tree.AbstractInsnNode> mergedInstructions that should be merged form disjoint sets. Coverage information from instructions of one set will be merged into representative instruction of set. Each such set is represented as a singly linked list: each element except one references another element from the same set, element without reference - is a representative of this set. This map stores reference (value) for elements of sets (key). -
replacements
-
-
Constructor Details
-
MethodCoverageCalculator
MethodCoverageCalculator(Map<org.objectweb.asm.tree.AbstractInsnNode, Instruction> instructions)
-
-
Method Details
-
calculate
Applies all specified filtering commands and calculates the resulting coverage.- Parameters:
coverage- the result is added to this coverage node
-
applyMerges
private void applyMerges() -
applyReplacements
private void applyReplacements() -
ensureCapacity
-
findRepresentative
private org.objectweb.asm.tree.AbstractInsnNode findRepresentative(org.objectweb.asm.tree.AbstractInsnNode i) -
ignore
public void ignore(org.objectweb.asm.tree.AbstractInsnNode fromInclusive, org.objectweb.asm.tree.AbstractInsnNode toInclusive) Description copied from interface:IFilterOutputMarks sequence of instructions that should be ignored during computation of coverage.- Specified by:
ignorein interfaceIFilterOutput- Parameters:
fromInclusive- first instruction that should be ignored, inclusivetoInclusive- last instruction coming afterfromInclusivethat should be ignored, inclusive
-
merge
public void merge(org.objectweb.asm.tree.AbstractInsnNode i1, org.objectweb.asm.tree.AbstractInsnNode i2) Description copied from interface:IFilterOutputMarks two instructions that should be merged during computation of coverage.- Specified by:
mergein interfaceIFilterOutput- Parameters:
i1- first instructioni2- second instruction
-
replaceBranches
public void replaceBranches(org.objectweb.asm.tree.AbstractInsnNode source, Set<org.objectweb.asm.tree.AbstractInsnNode> newTargets) Description copied from interface:IFilterOutputMarks instruction whose outgoing branches should be replaced during computation of coverage.- Specified by:
replaceBranchesin interfaceIFilterOutput- Parameters:
source- instruction which branches should be replacednewTargets- new targets of branches
-