aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core/src/org/jacoco
diff options
context:
space:
mode:
authorAllen Hair <allenhair+github@gmail.com>2017-12-20 14:46:56 -0800
committerEvgeny Mandrikov <Godin@users.noreply.github.com>2017-12-20 23:46:56 +0100
commite050f1948abedc1f298ce2c10392309801039f49 (patch)
tree55da3bde9088d3f4f17ec8081172577db57c9629 /org.jacoco.core/src/org/jacoco
parent4c0b93e8c1ae7166385bdea6fc059d86f1cb1c92 (diff)
downloadjacoco-e050f1948abedc1f298ce2c10392309801039f49.tar.gz
Instrumentation should not damage structured locking (#627)
Diffstat (limited to 'org.jacoco.core/src/org/jacoco')
-rw-r--r--org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java b/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java
index cff89112..5b3cb02c 100644
--- a/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java
+++ b/org.jacoco.core/src/org/jacoco/core/internal/flow/MethodProbesAdapter.java
@@ -62,19 +62,24 @@ public final class MethodProbesAdapter extends MethodVisitor {
}
@Override
- public void visitTryCatchBlock(Label start, final Label end,
+ public void visitTryCatchBlock(final Label start, final Label end,
final Label handler, final String type) {
- // If a probe will be inserted before the start label, we'll need to use
- // a different label for the try-catch block.
- if (tryCatchProbeLabels.containsKey(start)) {
- start = tryCatchProbeLabels.get(start);
- } else if (LabelInfo.needsProbe(start)) {
+ probesVisitor.visitTryCatchBlock(getTryCatchLabel(start), getTryCatchLabel(end),
+ handler, type);
+ }
+
+ private Label getTryCatchLabel(Label label) {
+ if (tryCatchProbeLabels.containsKey(label)) {
+ label = tryCatchProbeLabels.get(label);
+ } else if (LabelInfo.needsProbe(label)) {
+ // If a probe will be inserted before the label, we'll need to use a
+ // different label to define the range of the try-catch block.
final Label probeLabel = new Label();
LabelInfo.setSuccessor(probeLabel);
- tryCatchProbeLabels.put(start, probeLabel);
- start = probeLabel;
+ tryCatchProbeLabels.put(label, probeLabel);
+ label = probeLabel;
}
- probesVisitor.visitTryCatchBlock(start, end, handler, type);
+ return label;
}
@Override