aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core/src/org/jacoco/core/internal/analysis
diff options
context:
space:
mode:
authorMarc R. Hoffmann <hoffmann@mountainminds.com>2011-01-08 23:24:00 +0000
committerMarc R. Hoffmann <hoffmann@mountainminds.com>2011-01-08 23:24:00 +0000
commitbead2e4d671b2ec3bc5aca73c79830f5313f6c95 (patch)
tree20b1fe9966166946fdc0b58008a66a7edad9eb35 /org.jacoco.core/src/org/jacoco/core/internal/analysis
parentd7bc689de778a543a5208714b7931e4c61a8f385 (diff)
downloadjacoco-bead2e4d671b2ec3bc5aca73c79830f5313f6c95.tar.gz
SF #3152347: Handle JSR/RET instructions correctly.
Diffstat (limited to 'org.jacoco.core/src/org/jacoco/core/internal/analysis')
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/analysis/MethodAnalyzer.java13
1 files changed, 8 insertions, 5 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 eabe1243..a640fab5 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
@@ -44,7 +44,8 @@ public class MethodAnalyzer implements IMethodProbesVisitor {
private int lastLine = ISourceNode.UNKNOWN_LINE;
- private Label currentLabel = null;
+ // Due to ASM issue #315745 there can be more than one label per instruction
+ private final List<Label> currentLabel = new ArrayList<Label>(2);
/** List of all analyzed instructions */
private final List<Instruction> instructions = new ArrayList<Instruction>();
@@ -89,7 +90,7 @@ public class MethodAnalyzer implements IMethodProbesVisitor {
}
public void visitLabel(final Label label) {
- currentLabel = label;
+ currentLabel.add(label);
if (!LabelInfo.isSuccessor(label)) {
lastInsn = null;
}
@@ -111,9 +112,11 @@ public class MethodAnalyzer implements IMethodProbesVisitor {
if (lastInsn != null) {
insn.setPredecessor(lastInsn);
}
- if (currentLabel != null) {
- LabelInfo.setInstruction(currentLabel, insn);
- currentLabel = null;
+ while (!currentLabel.isEmpty()) {
+ for (int i = currentLabel.size(); --i >= 0;) {
+ LabelInfo.setInstruction(currentLabel.get(i), insn);
+ }
+ currentLabel.clear();
}
lastInsn = insn;
}