- 
                Notifications
    You must be signed in to change notification settings 
- Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug
Milestone
Description
ApplicationListenerMethodAdapter wrongly indicates it would support a generic event type exposing unresolved generics, even if there's no type relationship between the events at all. See the following, failing test case:
class ApplicationListenerMethodAdapterTests {
	@Test
	void testName() throws Exception {
		var method = ApplicationListenerMethodAdapterTests.class.getDeclaredMethod("listener", SomeOtherEvent.class);
		var adapter = new ApplicationListenerMethodAdapter(null, ApplicationListenerMethodAdapterTests.class, method);
		assertThat(adapter.supportsEventType(ResolvableType.forClass(SomeGenericEvent.class))).isFalse();
	}
	@EventListener
	void listener(SomeOtherEvent event) {}
	static class SomeGenericEvent<T> {}
	static class SomeOtherEvent {}
}Note how the adapter signals the event listener method would support SomeGenericEvent when it clearly doesn't.
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug