Skip to content

Commit b719858

Browse files
wangshsduFlyJingFish
authored andcommitted
完善获取原方法的方式
1 parent 2018cb7 commit b719858

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

android-aop-annotation/src/main/java/com/flyjingfish/android_aop_annotation/AndroidAopJoinPoint.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -300,17 +300,15 @@ private void getTargetMethod(){
300300
try {
301301
originalMethod = tClass.getDeclaredMethod(originalMethodName, classes);
302302
} catch (NoSuchMethodException exc) {
303-
// String realMethodName = getRealMethodName(originalMethodName);
304-
// if (realMethodName == null){
305-
// throw new RuntimeException(exc);
306-
// }
307-
// originalMethod = tClass.getDeclaredMethod(realMethodName, classes);
308-
System.out.println("=======>"+originalMethodName);
309-
originalMethod = Utils.INSTANCE.findMethodWithKeepName(tClass,originalMethodName,classes);
310-
if (originalMethod == null){
311-
throw new RuntimeException(exc);
303+
Method oriMethod = Utils.INSTANCE.findMethodWithKeepName(tClass,originalMethodName,classes);
304+
if (oriMethod == null){
305+
String realMethodName = getRealMethodName(originalMethodName);
306+
if (realMethodName == null){
307+
throw new RuntimeException(exc);
308+
}
309+
oriMethod = tClass.getDeclaredMethod(realMethodName, classes);
312310
}
313-
System.out.println("=======>"+originalMethodName+"<==Success="+originalMethod.getName());
311+
originalMethod = oriMethod;
314312
}
315313
targetMethod.setAccessible(true);
316314
originalMethod.setAccessible(true);

0 commit comments

Comments
 (0)