refactor: use constant dollar symbol

This commit is contained in:
金戟
2022-05-29 14:08:35 +08:00
parent 1a2083416e
commit b2a87bffbe
3 changed files with 5 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import static com.alibaba.testable.core.constant.ConstPool.CONSTRUCTOR;
import static com.alibaba.testable.core.constant.ConstPool.DOLLAR;
/**
* @author flin
@@ -70,7 +71,7 @@ public class SourceClassHandler extends BaseClassHandler {
private void transformMethod(MethodNode mn, Set<MethodInfo> memberInjectMethods,
Set<MethodInfo> newOperatorInjectMethods) {
LogUtil.verbose(" Found method %s", mn.name);
if (mn.name.startsWith("$")) {
if (mn.name.startsWith(DOLLAR)) {
// skip methods e.g. "$jacocoInit"
return;
}

View File

@@ -239,7 +239,7 @@ public class ClassUtil {
* @return outer class name
*/
public static String toOuterClassName(String name) {
int pos = name.lastIndexOf("$");
int pos = name.lastIndexOf(DOLLAR);
return (pos > 0) ? name.substring(0, pos) : name;
}

View File

@@ -3,6 +3,7 @@ package com.alibaba.testable.core.tool;
import com.alibaba.testable.core.exception.ClassConstructionException;
import com.alibaba.testable.core.model.ConstructionOption;
import com.alibaba.testable.core.util.CollectionUtil;
import com.alibaba.testable.core.util.ConstructionUtil;
import com.alibaba.testable.core.util.LogUtil;
import com.alibaba.testable.core.util.TypeUtil;
@@ -180,7 +181,7 @@ public class OmniConstructor {
}
classPool.put(type, instance);
for (Field f : TypeUtil.getAllFields(type)) {
if (f.getName().startsWith("$") || isStaticFinalField(f)) {
if (f.getName().startsWith(DOLLAR) || isStaticFinalField(f)) {
// skip static-final fields and fields e.g. "$jacocoData"
continue;
}