Using JEE 6 Events:
@Qualifier
@Target(value = { ElementType.FIELD, ElementType.PARAMETER })
@Retention(RetentionPolicy.RUNTIME)
public @interface OrganisationCreateEvent {
}
Given handling method signiture snippit:
@Observes @OrganisationCreateEvent Set<[color=red]OrganisationUserRole[/color]> organisationUserRole
called by code:
// Events
@Inject
@OrganisationCreateEvent
Event<[color=red]Organisation[/color]> createEvent;
...
this.createEvent.fire(organisation);
I would expect the static analysis tools to see this is incompatible; but they do not.
JEE 6 has made significant progress in strong typing to allow IDE’s to truly help in this area (a leap forward from Spring “strings”)
Took a long time to spot this as i was so used to MyEclipse being so good at spotting stuff like this.
Also turns out that you can have a HashSet in an event using Weld…. (Not 100% sure on this however)
Spec:
http://docs.oracle.com/javaee/6/tutorial/doc/gkhic.html
Please advise.