aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core
diff options
context:
space:
mode:
authorEvgeny Mandrikov <Godin@users.noreply.github.com>2018-08-20 21:18:12 +0200
committerMarc R. Hoffmann <hoffmann@mountainminds.com>2018-08-20 21:18:12 +0200
commit1cd039a534b9e9354b1a7f6de797c0a99d75291c (patch)
tree1c2c1c85460f47b7790c8d8a4b30b56d20e7c39f /org.jacoco.core
parent964778bb48e3bbc63f5e9b174e7af371aa1f05ae (diff)
downloadjacoco-1cd039a534b9e9354b1a7f6de797c0a99d75291c.tar.gz
All merged instructions should have same covered branches (#747)
Because result of merge might be used to compute coverage of instructions with replaced branches.
Diffstat (limited to 'org.jacoco.core')
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java b/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java
index 82b97466..78adf91a 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java
@@ -370,7 +370,7 @@ public class MethodAnalyzer extends MethodProbesVisitor
p.instruction.setCovered(p.branch);
}
- // Merge:
+ // Merge into representative instruction:
for (final Instruction i : instructions) {
final AbstractInsnNode m = i.getNode();
final AbstractInsnNode r = findRepresentative(m);
@@ -380,6 +380,16 @@ public class MethodAnalyzer extends MethodProbesVisitor
}
}
+ // Merge from representative instruction, because result of merge might
+ // be used to compute coverage of instructions with replaced branches:
+ for (final Instruction i : instructions) {
+ final AbstractInsnNode m = i.getNode();
+ final AbstractInsnNode r = findRepresentative(m);
+ if (r != m) {
+ i.merge(nodeToInstruction.get(r));
+ }
+ }
+
// Report result:
coverage.ensureCapacity(firstLine, lastLine);
for (final Instruction i : instructions) {