aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {