for better performance

This commit is contained in:
金戟 2021-07-12 20:37:13 +08:00
parent fd3b088f59
commit 2780ccc6fa
2 changed files with 3 additions and 5 deletions

View File

@ -253,7 +253,7 @@ public class TestableClassTransformer implements ClassFileTransformer {
private String parseMockWithAnnotation(ClassNode cn, ClassType expectedType) {
if (cn.visibleAnnotations != null) {
for (AnnotationNode an : cn.visibleAnnotations) {
if (ClassUtil.toJavaStyleClassName(an.desc).equals(ConstPool.MOCK_WITH)) {
if ((ClassUtil.toByteCodeClassName(ConstPool.MOCK_WITH)).equals(an.desc)) {
ClassType type = AnnotationUtil.getAnnotationParameter(an, FIELD_TREAT_AS, ClassType.GuessByName,
ClassType.class);
if (isExpectedType(cn.name, type, expectedType)) {
@ -271,7 +271,7 @@ public class TestableClassTransformer implements ClassFileTransformer {
private String getDumpPathByAnnotation(ClassNode cn) {
if (cn.visibleAnnotations != null) {
for (AnnotationNode an : cn.visibleAnnotations) {
if (ClassUtil.toJavaStyleClassName(an.desc).equals(ConstPool.DUMP_TO)) {
if ((ClassUtil.toByteCodeClassName(ConstPool.DUMP_TO)).equals(an.desc)) {
String path = AnnotationUtil.getAnnotationParameter(an, FIELD_VALUE, null, String.class);
String fullPath = PathUtil.join(System.getProperty(PROPERTY_USER_DIR), path);
if (createFolder(fullPath)) {

View File

@ -6,8 +6,6 @@ import com.alibaba.testable.core.util.LogUtil;
import org.objectweb.asm.tree.AnnotationNode;
import org.objectweb.asm.tree.ClassNode;
import static com.alibaba.testable.agent.util.ClassUtil.toJavaStyleClassName;
public class DiagnoseUtil {
private static final String FIELD_VALUE = "value";
@ -17,7 +15,7 @@ public class DiagnoseUtil {
return;
}
for (AnnotationNode an : cn.visibleAnnotations) {
if (toJavaStyleClassName(an.desc).equals(ConstPool.MOCK_DIAGNOSE)) {
if (ClassUtil.toByteCodeClassName(ConstPool.MOCK_DIAGNOSE).equals(an.desc)) {
setupDiagnose(an, FIELD_VALUE);
}
}