[slf4j-dev] svn commit: r1183 - slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation
ravn at slf4j.org
ravn at slf4j.org
Sat Oct 4 00:50:10 CEST 2008
Author: ravn
Date: Sat Oct 4 00:50:09 2008
New Revision: 1183
Modified:
slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java
Log:
fixed incorrectly placed quote in result snippet
Modified: slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java
==============================================================================
--- slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java (original)
+++ slf4j/trunk/slf4j-ext/src/main/java/org/slf4j/instrumentation/JavassistHelper.java Sat Oct 4 00:50:09 2008
@@ -2,7 +2,6 @@
import javassist.CtBehavior;
import javassist.CtClass;
-import javassist.CtConstructor;
import javassist.CtMethod;
import javassist.Modifier;
import javassist.NotFoundException;
@@ -16,7 +15,7 @@
String returnValue = "";
if (methodReturnsValue(method)) {
- returnValue = "\" returns: \" + $_ ";
+ returnValue = " returns: \" + $_ + \"";
}
return returnValue;
}
@@ -24,15 +23,16 @@
private static boolean methodReturnsValue(CtBehavior method)
throws NotFoundException {
+ if (method instanceof CtMethod == false) {
+ return false;
+ }
+
CtClass returnType = ((CtMethod) method).getReturnType();
String returnTypeName = returnType.getName();
- boolean isVoidMethod = (method instanceof CtMethod)
- && "void".equals(returnTypeName);
+ boolean isVoidMethod = "void".equals(returnTypeName);
- boolean isConstructor = method instanceof CtConstructor;
-
- boolean methodReturnsValue = (isVoidMethod || isConstructor) == false;
+ boolean methodReturnsValue = isVoidMethod == false;
return methodReturnsValue;
}
@@ -79,12 +79,18 @@
if (locals == null) {
return Integer.toString(i + 1);
}
+
- if (Modifier.isStatic(method.getModifiers())) {
- return locals.variableName(i);
+ int modifiers = method.getModifiers();
+
+ int j = i;
+
+
+
+ if (Modifier.isStatic(modifiers) == false) {
+ // skip #0 which is "this"
+ j++;
}
-
- // skip #0 which is reference to "this"
- return locals.variableName(i + 1);
+ return locals.variableName(j);
}
}
More information about the slf4j-dev
mailing list