diff options
author | Evgeny Mandrikov <138671+Godin@users.noreply.github.com> | 2019-06-11 18:16:52 +0200 |
---|---|---|
committer | Marc R. Hoffmann <hoffmann@mountainminds.com> | 2019-06-11 18:16:52 +0200 |
commit | 6c62355297e378224d8fba1dd1c26d75b7ed998b (patch) | |
tree | b494f35574f25b80b0b9f3ecc21bc1963ff0bb81 /org.jacoco.core/src/org | |
parent | 219088deac4b5af5d5c7346da65042894585d5c4 (diff) | |
download | jacoco-6c62355297e378224d8fba1dd1c26d75b7ed998b.tar.gz |
ProbeInserter should update indexes of local variables in annotations (#894)
Diffstat (limited to 'org.jacoco.core/src/org')
-rw-r--r-- | org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java b/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java index 63fbf765..0a03c69e 100644 --- a/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java +++ b/org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java @@ -11,10 +11,12 @@ *******************************************************************************/ package org.jacoco.core.internal.instr; +import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; +import org.objectweb.asm.TypePath; /** * Internal utility to add probes into the control flow of a method. The code @@ -112,6 +114,18 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter { } @Override + public AnnotationVisitor visitLocalVariableAnnotation(final int typeRef, + final TypePath typePath, final Label[] start, final Label[] end, + final int[] index, final String descriptor, final boolean visible) { + final int[] newIndex = new int[index.length]; + for (int i = 0; i < newIndex.length; i++) { + newIndex[i] = map(index[i]); + } + return mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, + newIndex, descriptor, visible); + } + + @Override public void visitMaxs(final int maxStack, final int maxLocals) { // Max stack size of the probe code is 3 which can add to the // original stack size depending on the probe locations. The accessor |