I understand the 4.3.1. subsection in the following way:
If X -> Z -> Y, then X specializes both Y and Z. Therefore X inherits the qualifiers
and bean name of Y, but also X inherits the qualifiers and bean name of Z.
The problem is that there are 2 rules for what the qualifiers of X should include:
• all qualifiers of Y, together with all qualifiers declared explicitly by X, and
• all qualifiers of Z, together with all qualifiers declared explicitly by X,
which might seem to be a contradiction. However, it does not say that the qualifiers of X
do NOT include anything else (include => mathematical subset) so the option for
including all of them wins IMO.
If the intention was as Mark mentioned, then a clarification is strongly needed.
If the intention was not to ignore the beans in-between, then the rule for indirect
specialization seems quite redundant to me.
Indeed, if X -> Z -> Y, then Z specializes Y. Therefore Z inherits the qualifiers
and bean name of Y.
Furthermore, X inherits the qualifiers and bean name of Z (because X -> Z), so X
inherits the qualifiers and bean name of Y (transitively).
And what about the restrictions and definition errors? No worry about that. When you think
about it:
- If the set of the types of X (denote Types(X)) has to be a subset of Types(Z), and
Types(Z) ⊆ Types(Y), then also Types(X) ⊆ Types(Y).
- If Y has a bean name and X declares a bean name explicitly, then Z inherits the Y's
bean name and the problem is still detected.
WDYT?
Matus
----- Original Message -----
From: "Mark Struberg" <struberg(a)yahoo.de>
To: cdi-dev(a)lists.jboss.org
Sent: Tuesday, June 3, 2014 10:37:00 AM
Subject: [cdi-dev] Challenge TCK test for indirect specialization rules
Hi!
The question is about
org.jboss.cdi.tck.tests.inheritance.specialization.simple.SimpleBeanSpecializationTest#testSpecializingBeanHasNameOfSpecializedBean
and a few other tests in there.
Imo they directly contradict 4.3.1 of the spec:
-------
Formally, a bean X is said to specialize another bean Y if either:
• X directly specializes Y, or
• a bean Z exists, such that X directly specializes Z and Z specializes Y. Then X will
inherit the qualifiers and bean name of Y:
• the qualifiers of X include all qualifiers of Y, together with all qualifiers declared
explicitly by X, and
• if Y has a bean name, the bean name of X is the same as the bean name of Y.
-------
in this wording the 'intermediate class' Z in the inheritance chain X -> Z
-> Y intentionally gets ignored imo.
It explicitly doesn't say that 'all @Specializes up in the chain' do account
for the name and qualifiers.
To me it reads like the 'last' (outermost) @Specializes and the 'first'
non-specializes beans do count. All @Specializes beans in-between get ignored when it
comes to @Named and @Qualifier resolution.
There was imo also a test for it in the CDI-1.0 TCK which we did successfully pass. But
obviously this got rewritten to a different behavior.
Here is the transcript of my discussion with martin and jozef so far:
http://transcripts.jboss.org/channel/irc.freenode.org/%23jsr346/2014/%23j...
txs and LieGrue,
strub
_______________________________________________
cdi-dev mailing list
cdi-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev