Details
-
Clarification
-
Resolution: Obsolete
-
Minor
-
None
-
None
-
None
Description
Stereotype declarations are transitive. However, the spec is not clear what happens if a stereotype declares a default scope and also a second stereotype which also declares a default scope. Only "If a stereotype declares more than one scope, the container automatically detects the problem and treats it as a definition error." is defined.
Weld currently does merge the stereotypes and throws DefinitionException if NOT all stereotypes specify the same scope and the bean does NOT declare a scope (this makes sense imho).
Note that this is not a problem for @Named, @Alternative and interceptor bindings.
Any @Alternative makes a bean an alternative. Any @Named means the name is defaulted. All bindings are added to the set.
UPDATE: Interceptor bindings are probably also affected. The interceptors spec defines "An interceptor binding declared on a method or constructor replaces an interceptor binding of the same type declared at class level or inherited from a superclass." (3.3 Binding an Interceptor to a Component) which implies that multiple interceptor bindings of the same type are not supported. So the spec should probably cover cases where stereotypes declare the interceptor bindings of the same type.