@@ -25,6 +25,7 @@ public class BlackReflectionProxy {
2525
2626 private final ClassName mContextInterface ;
2727 private final ClassName mStaticInterface ;
28+ private final ClassName mInterface ;
2829 private final String mPackageName ;
2930
3031 public BlackReflectionProxy (String packageName , BlackReflectionInfo reflection ) {
@@ -36,6 +37,7 @@ public BlackReflectionProxy(String packageName, BlackReflectionInfo reflection)
3637
3738 mContextInterface = ClassName .get (ClassUtils .getPackage (finalClass ), ClassUtils .getName (finalClass + "Context" ));
3839 mStaticInterface = ClassName .get (ClassUtils .getPackage (finalClass ), ClassUtils .getName (finalClass + "Static" ));
40+ mInterface = ClassName .get (ClassUtils .getPackage (finalClass ), ClassUtils .getName (finalClass ));
3941 }
4042
4143 public JavaFile generateJavaCode () {
@@ -50,7 +52,7 @@ public JavaFile generateJavaCode() {
5052 .addMethod (generaNotCallerMethod (false ))
5153 .addMethod (generaCallerMethod (true ))
5254 .addMethod (generaCallerMethod (false ))
53- .addMethod (generaIsLoadMethod ())
55+ .addMethod (generaGetRealClassMethod ())
5456 .build ();
5557 return JavaFile .builder (mPackageName , reflection ).build ();
5658 }
@@ -83,14 +85,14 @@ private MethodSpec generaCallerMethod(boolean withException) {
8385 return builder .build ();
8486 }
8587
86- private MethodSpec generaIsLoadMethod () {
88+ private MethodSpec generaGetRealClassMethod () {
8789 MethodSpec .Builder builder = MethodSpec .methodBuilder ("getRealClass" )
8890 .addModifiers (Modifier .PUBLIC , Modifier .STATIC )
8991 .returns (ClassName .get (Class .class ));
9092
9193 String statement = "return top.niunaijun.blackreflection.utils.ClassUtil.classReady($T.class)" ;
9294 builder .addStatement (statement ,
93- mContextInterface
95+ mInterface
9496 );
9597 return builder .build ();
9698 }
0 commit comments