mirror of
https://github.com/alibaba/testable-mock.git
synced 2026-08-19 09:43:29 +08:00
refactor: use constant dollar symbol
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user