feat: Enhance core framework with improved service faking, package management, and build system updates.

intigrated disable flag secure

remove comments cleanup codes
This commit is contained in:
ArtRuntime
2026-02-04 22:09:34 +05:30
parent e770372144
commit 9c744770f8
389 changed files with 4621 additions and 7834 deletions
@@ -2,9 +2,9 @@ package top.niunaijun.blackreflection;
public class BlackReflectionInfo {
// 反射指向的类
private String realClass;
// 当前注解的className
private String className;
public String getClassName() {
@@ -4,9 +4,9 @@ import javax.lang.model.element.ExecutableElement;
public class BlackReflectionInterfaceInfo {
// 方法element
private ExecutableElement executableElement;
// 是否是字段
private boolean isField;
public boolean isField() {
@@ -43,7 +43,7 @@ public class BlackReflectionProcessor extends AbstractProcessor {
private Map<String, String> mRealMaps = new HashMap<>();
private Messager mMessager;
private Elements mElementUtils; //元素相关的辅助类
private Elements mElementUtils;
private Filer mFiler;
@Override
@@ -153,7 +153,7 @@ public class BlackReflectionProcessor extends AbstractProcessor {
getReflectionProxy(packageName, className, info);
// 创建两个基本类
getReflectionInterfaceProxy(packageName, className + "Context",
className);
getReflectionInterfaceProxy(packageName, className + "Static",
@@ -163,11 +163,11 @@ public class BlackReflectionProcessor extends AbstractProcessor {
private static TypeMirror getClass(BClass annotation) {
try {
annotation.value(); // this should throw
annotation.value();
} catch (MirroredTypeException mte) {
return mte.getTypeMirror();
}
return null; // can this ever happen ??
return null;
}
public BlackReflectionProxy getReflectionProxy(String packageName, String className, BlackReflectionInfo info) {
@@ -30,22 +30,15 @@ import top.niunaijun.blackreflection.annotation.BParamClass;
import top.niunaijun.blackreflection.annotation.BClassNameNotProcess;
import top.niunaijun.blackreflection.annotation.BParamClassName;
/**
* Created by sunwanquan on 2020/1/8.
* * ∧_∧
* (`・ω・∥
* 丶 つ0
* しーJ
* 此处无Bug
*/
public class BlackReflectionInterfaceProxy {
private final List<BlackReflectionInterfaceInfo> mReflections = new ArrayList<>();
// fake.android.app.ActivityThreadStatic or ActivityThreadContext
private final String mClassName;
// fake.android.app
private final String mPackageName;
// fake.android.app.ActivityThread
private final String mOrigClassName;
private Map<String, String> realMaps;
@@ -63,7 +56,7 @@ public class BlackReflectionInterfaceProxy {
.addMember("value","$S", realMaps.get(mOrigClassName))
.build();
// generaClass
TypeSpec.Builder interfaceBuilder = TypeSpec.interfaceBuilder(finalClass)
.addAnnotation(annotationSpec)
.addModifiers(Modifier.PUBLIC);
@@ -100,16 +93,16 @@ public class BlackReflectionInterfaceProxy {
method.returns(typeName.box());
if (reflection.isField()) {
method.addAnnotation(AnnotationSpec.builder(BFieldNotProcess.class).build());
// set field
interfaceBuilder.addMethod(generateFieldSet(reflection));
// check field
interfaceBuilder.addMethod(generateFieldCheck(reflection));
} else {
BConstructor annotation = reflection.getExecutableElement().getAnnotation(BConstructor.class);
if (annotation != null) {
method.addAnnotation(AnnotationSpec.builder(BConstructorNotProcess.class).build());
} else {
// check method
interfaceBuilder.addMethod(generateMethodCheck(reflection, parameterSpecs));
}
}
@@ -155,11 +148,11 @@ public class BlackReflectionInterfaceProxy {
private static TypeMirror getClass(BParamClass annotation) {
try {
annotation.value(); // this should throw
annotation.value();
} catch (MirroredTypeException mte) {
return mte.getTypeMirror();
}
return null; // can this ever happen ??
return null;
}
private static Class<?> parseBaseClass(String className) {
@@ -10,14 +10,7 @@ import javax.lang.model.element.Modifier;
import top.niunaijun.blackreflection.BlackReflectionInfo;
import top.niunaijun.blackreflection.utils.ClassUtils;
/**
* Created by sunwanquan on 2020/1/8.
* * ∧_∧
* (`・ω・∥
* 丶 つ0
* しーJ
* 此处无Bug
*/
public class BlackReflectionProxy {
private static final ClassName BR = ClassName.get("top.niunaijun.blackreflection", "BlackReflection");
@@ -43,7 +36,7 @@ public class BlackReflectionProxy {
.replace(mPackageName + ".", "")
.replace(".", "");
// generaClass
TypeSpec reflection = TypeSpec.classBuilder(finalClass)
.addModifiers(Modifier.PUBLIC)
.addMethod(generaNotCallerMethod(true))
@@ -1,14 +1,7 @@
package top.niunaijun.blackreflection.utils;
/**
* Created by sunwanquan on 2020/1/8.
* * ∧_∧
* (`・ω・∥
* 丶 つ0
* しーJ
* 此处无Bug
*/
public class ClassUtils {
public static String getPackage(String className) {