Skip to content

Conversation

@slelyuk
Copy link

@slelyuk slelyuk commented Feb 19, 2016

It is so unexpected when throwSubscriberException=false but it still crashing if there is no subscribers. In my case it happened in base fragment's class and I was really confused when realized that I can't disable this kind of check.

…annotation if throwSubscriberException=false
@jiaxin11
Copy link

oh ..

subscriberMethods = findUsingInfo(subscriberClass);
}
if (subscriberMethods.isEmpty()) {
if (subscriberMethods.isEmpty() && throwSubscriberException) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really want to do this, you should do like this:

if (subscriberMethods.isEmpty()) {
    if (throwSubscriberException) {
        throw new EventBusException("Subscriber " + subscriberClass
                + " and its super classes have no public methods with the @Subscribe annotation");
    }
} else {
    METHOD_CACHE.put(subscriberClass, subscriberMethods);
    return subscriberMethods;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants