caarmen / network-monitor

A network monitor tool for Android that executes an http GET to google.com every x seconds and logs the results into a file.
74 stars 27 forks source link

API incompatible use. #110

Closed jay2013 closed 6 years ago

jay2013 commented 6 years ago

Hi, Our tool report that API "<java.lang.reflect.Method: boolean isAnnotationPresent(java.lang.Class)> " called in "<org.greenrobot.eventbus.SubscriberMethodFinder: void findUsingReflectionInSingleClass(org.greenrobot.eventbus.SubscriberMethodFinder$FindState)>" on line 179 is not in level [24, 25].

We also checked your codes but we are not sure whether "strictMethodVerification" is always false when your app run on devices of level [24, 25].

Please help to check it, thanks very much.

best regards,

Dongjie He

caarmen commented 6 years ago

The default EventBusBuilder is used, which sets:

When MainActivity starts for the first time, SubscriberMethodFinder.findSubscriberMethods() is called. The first time, the cache is empty. Since ignoreGeneratedIndex is false, it doesn't call findUsingReflection(). Instead, it calls findUsingInfo(), which calls findUsingReflectionInSingleClass(). Once here, method.isAnnotationPresent() isn't called because strictMethodVerification is false.

Tested by adding breakpoints on api level 22 and 24 devices.

For more info on how this library works internally (in particular how the default builder works), please check out their repo: https://github.com/greenrobot/EventBus