Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Genericize ApplicationListener [SPR-4610] #9287

Closed
spring-projects-issues opened this issue Mar 21, 2008 · 1 comment
Closed

Genericize ApplicationListener [SPR-4610] #9287

spring-projects-issues opened this issue Mar 21, 2008 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Paul Benedict opened SPR-4610 and commented

It would be fantastic if ApplicationListener could be genericized so that the event argument automatically becomes the parameterized type. Maybe worth looking at in 3.0? In any event (pun intended), the framework could then skip over invoking the handler if the typed argument is not the correct type. This would eliminate the boilerplate of "if (event instanceof MySubclassEvent)" checks.

Can anything be done like this in 2.5?


Affects: 2.5.2

1 votes, 1 watchers

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

This is on the plan for Spring 3.0 M1 in June. I'm afraid there won't be any such support in the 2.5 series since we're about to focus all our new feature efforts on 3.0 M1/M2. Furthermore, implementing such generically typed listener detection isn't completely trivial due to Java's half-baked support for reflective analysis of generic declaration.

FYI, we're aiming for a 3.0 RC1 in August, so a production version of this is hopefully not too far away...

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants