bennidi / mbassador

Powerful event-bus optimized for high throughput in multi-threaded applications. Features: Sync and Async event publication, weak/strong references, event filtering, annotation driven
MIT License
955 stars 146 forks source link

Handlers in inner classes not recognized #147

Closed fgrazi closed 5 years ago

fgrazi commented 7 years ago

I noticed that methods of inner classes annotated with @Handler are not recognized, For example:

public class MyClass {
    @Handler
    public void handle(Notification notification) {
        System.out.println(notification); // this works
    }

    public static class MyInnerClass {

        @Handler
        public void handle(Notification notification) {
            System.out.println(notification); // does not work
        }
    }

}

Is it possible to extend recognition of listeners to inner classes?

chriskingnet commented 6 years ago

Hello @fgrazi,

I was going to pick this up to work on, however this actually seems to me to be expected behaviour. If I want to subscribe the MyInnerClass listener, I should subscribe it explicitly. What do you think?

fgrazi commented 6 years ago

Hi Chris, yes you are absolutely right. I'm sure that when I opened the issue I subscribed it explicitly and did not work. Maybe I was using an old version. I tried again right now on a small chunk of code and it works fine. Maybe I was goofing at something else. Please consider the issue closed and congratulations! Mbassador is really useful. I migrated to it from Guice EventBus and use effectively in Vaadin applications. Cheers, Franco.