@@ -25,6 +25,7 @@ public class BlackReflectionProxy {
25
25
26
26
private final ClassName mContextInterface ;
27
27
private final ClassName mStaticInterface ;
28
+ private final ClassName mInterface ;
28
29
private final String mPackageName ;
29
30
30
31
public BlackReflectionProxy (String packageName , BlackReflectionInfo reflection ) {
@@ -36,6 +37,7 @@ public BlackReflectionProxy(String packageName, BlackReflectionInfo reflection)
36
37
37
38
mContextInterface = ClassName .get (ClassUtils .getPackage (finalClass ), ClassUtils .getName (finalClass + "Context" ));
38
39
mStaticInterface = ClassName .get (ClassUtils .getPackage (finalClass ), ClassUtils .getName (finalClass + "Static" ));
40
+ mInterface = ClassName .get (ClassUtils .getPackage (finalClass ), ClassUtils .getName (finalClass ));
39
41
}
40
42
41
43
public JavaFile generateJavaCode () {
@@ -50,7 +52,7 @@ public JavaFile generateJavaCode() {
50
52
.addMethod (generaNotCallerMethod (false ))
51
53
.addMethod (generaCallerMethod (true ))
52
54
.addMethod (generaCallerMethod (false ))
53
- .addMethod (generaIsLoadMethod ())
55
+ .addMethod (generaGetRealClassMethod ())
54
56
.build ();
55
57
return JavaFile .builder (mPackageName , reflection ).build ();
56
58
}
@@ -83,14 +85,14 @@ private MethodSpec generaCallerMethod(boolean withException) {
83
85
return builder .build ();
84
86
}
85
87
86
- private MethodSpec generaIsLoadMethod () {
88
+ private MethodSpec generaGetRealClassMethod () {
87
89
MethodSpec .Builder builder = MethodSpec .methodBuilder ("getRealClass" )
88
90
.addModifiers (Modifier .PUBLIC , Modifier .STATIC )
89
91
.returns (ClassName .get (Class .class ));
90
92
91
93
String statement = "return top.niunaijun.blackreflection.utils.ClassUtil.classReady($T.class)" ;
92
94
builder .addStatement (statement ,
93
- mContextInterface
95
+ mInterface
94
96
);
95
97
return builder .build ();
96
98
}
0 commit comments