mirror of
https://github.com/alibaba/testable-mock.git
synced 2026-08-22 19:23: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 java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import static com.alibaba.testable.core.constant.ConstPool.CONSTRUCTOR;
|
import static com.alibaba.testable.core.constant.ConstPool.CONSTRUCTOR;
|
||||||
|
import static com.alibaba.testable.core.constant.ConstPool.DOLLAR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author flin
|
* @author flin
|
||||||
@@ -70,7 +71,7 @@ public class SourceClassHandler extends BaseClassHandler {
|
|||||||
private void transformMethod(MethodNode mn, Set<MethodInfo> memberInjectMethods,
|
private void transformMethod(MethodNode mn, Set<MethodInfo> memberInjectMethods,
|
||||||
Set<MethodInfo> newOperatorInjectMethods) {
|
Set<MethodInfo> newOperatorInjectMethods) {
|
||||||
LogUtil.verbose(" Found method %s", mn.name);
|
LogUtil.verbose(" Found method %s", mn.name);
|
||||||
if (mn.name.startsWith("$")) {
|
if (mn.name.startsWith(DOLLAR)) {
|
||||||
// skip methods e.g. "$jacocoInit"
|
// skip methods e.g. "$jacocoInit"
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ public class ClassUtil {
|
|||||||
* @return outer class name
|
* @return outer class name
|
||||||
*/
|
*/
|
||||||
public static String toOuterClassName(String name) {
|
public static String toOuterClassName(String name) {
|
||||||
int pos = name.lastIndexOf("$");
|
int pos = name.lastIndexOf(DOLLAR);
|
||||||
return (pos > 0) ? name.substring(0, pos) : name;
|
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.exception.ClassConstructionException;
|
||||||
import com.alibaba.testable.core.model.ConstructionOption;
|
import com.alibaba.testable.core.model.ConstructionOption;
|
||||||
import com.alibaba.testable.core.util.CollectionUtil;
|
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.LogUtil;
|
||||||
import com.alibaba.testable.core.util.TypeUtil;
|
import com.alibaba.testable.core.util.TypeUtil;
|
||||||
|
|
||||||
@@ -180,7 +181,7 @@ public class OmniConstructor {
|
|||||||
}
|
}
|
||||||
classPool.put(type, instance);
|
classPool.put(type, instance);
|
||||||
for (Field f : TypeUtil.getAllFields(type)) {
|
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"
|
// skip static-final fields and fields e.g. "$jacocoData"
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user