[cdi-dev] @Alternative Stereotypes and AfterTypeDiscovery

Martin Kouba mkouba at redhat.com
Mon May 12 03:52:23 EDT 2014

Hi Mark,

comments inline.

Dne 12.5.2014 08:29, Mark Struberg napsal(a):
> Hi folks!
> There are 3 kind of Alternatives
> 1.) @Alternative classes activated via beans.xml
> 2.) @Alternative stereotypes activated via beans.xml
> 3.) @Alternative classes automatically activated by having a @Priority
> annotation as well
> Question A.):
> There is nothing in the spec regarrding @Alternative Stereotypes with
> @Priority atm. So I assume @Priority on a @Stereotype annotation does
> exactly nothing, right?

I think so.

> Queation B.):
> What if a class has a at Priority annotation and an @Alternative
> Stereotype? Should those automatically get picked up as Alternative as well?

I believe it should be selected. "2.7.1. Declaring an alternative"
states it's an alternative and "5.1.1 Declaring selected alternatives"
states it should be selected for an entire application. I'm not sure if
it works in Weld though... In any case it's a good candidate for a TCK
test, I will create a new TCK issue.

> ..
> Quesion C.):
> What does AfterTypeDisovery#getAlternatives() really return?
> Only the Alternative Classes added via beans.xml or with @Priority? Or
> all Classes, means also the ones which have an @Alternative @Stereotype?
> The later would make more sense to me imo. But is it meant that way? How
> does Weld behave?

AfterTypeDisovery#getAlternatives() should return "the ordered list of
enabled alternatives for the application" -> @Priority only. Note that
the event is fired globally so you can't include all the selected

However, the javadoc is outdated right now (see CDI-434). And I also
found another issue with ATD#getAlternatives() (see CDI-437).

> LieGrue,
> strub
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev

More information about the cdi-dev mailing list