Phenomenon: usually we register EventBus in the base class and annotate the subscribe method in the subclass, but if there is no public method in the subclass,the Eventbus will report : Fragment and its super classes have no public methods with the @Subscribe annotation
Suggestion: delete this code:
if (subscriberMethods.isEmpty()) {
throw new EventBusException("Subscriber " + subscriberClass
" and its super classes have no public methods with the @Subscribe annotation");
}
so:When subscriberMethods is empty, it returns subscriberMethods directly and no more errors are reported
that 's nice cause when subscriberMethods have no data but it 's not null,it will not crash
but with EventBusException throwed ,the developers will know the reason of not recevie events
Phenomenon: usually we register EventBus in the base class and annotate the subscribe method in the subclass, but if there is no public method in the subclass,the Eventbus will report : Fragment and its super classes have no public methods with the @Subscribe annotation
Suggestion: delete this code: if (subscriberMethods.isEmpty()) { throw new EventBusException("Subscriber " + subscriberClass
so:When subscriberMethods is empty, it returns subscriberMethods directly and no more errors are reported