Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Subclasses of Event cannot be used in subscriber method signature #33

@ivo-k

Description

@ivo-k

Shouldn't be this test the other way around?

Event.isAssignableFrom(parameterTypes[0])

instead of

else if(hasArgument && parameterTypes[0].isAssignableFrom(Event)) {

At the moment I cannot derive form Event and use this subclass directly in subscriber method.

class MyEvent extends Event {
...
}

class Handler {
    @Subcriber("myEvent")
    void handleEvent(MyEvent event) {
    }
}

This does not work.

A workaround is as follows:

class Handler {
    @Subcriber("myEvent")
    void handleEvent(Event event) {
         MyEvent e = (MyEvent) event
         ...
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions