Proper debug names for instrumenters

This commit is contained in:
Andrey Breslav
2013-05-12 10:51:28 +02:00
parent c960dff166
commit 113864fc88
2 changed files with 5 additions and 2 deletions
@@ -94,6 +94,7 @@ public class InterceptionInstrumenter implements Instrumenter {
String nameFromAnnotation = annotation.methodName();
String methodName = nameFromAnnotation.isEmpty() ? field.getName() : nameFromAnnotation;
MethodInstrumenterImpl instrumenter = new MethodInstrumenterImpl(
field.getDeclaringClass().getSimpleName() + "." + field.getName(),
compilePattern(methodName),
compilePattern(annotation.erasedSignature()),
annotation.allowMultipleMatches(),
@@ -20,6 +20,7 @@ import java.util.List;
import java.util.regex.Pattern;
class MethodInstrumenterImpl implements MethodInstrumenter {
private final String debugName;
private final Pattern namePattern;
private final Pattern descPattern;
private final boolean allowMultipleMatches;
@@ -28,13 +29,14 @@ class MethodInstrumenterImpl implements MethodInstrumenter {
private final boolean logApplications;
public MethodInstrumenterImpl(
Pattern namePattern,
String debugName, Pattern namePattern,
Pattern descPattern,
boolean allowMultipleMatches,
List<MethodData> enterData,
List<MethodData> exitData,
boolean logApplications
) {
this.debugName = debugName;
this.namePattern = namePattern;
this.descPattern = descPattern;
this.allowMultipleMatches = allowMultipleMatches;
@@ -72,6 +74,6 @@ class MethodInstrumenterImpl implements MethodInstrumenter {
@Override
public String toString() {
return namePattern + " " + descPattern + (allowMultipleMatches ? " [multiple]" : "");
return debugName + "[" + namePattern + " " + descPattern + (allowMultipleMatches ? " multiple" : "") + "]";
}
}