[cdi-dev] [JBoss JIRA] (CDI-703) Carify indirect specialization

Matej Novotny (JIRA) issues at jboss.org
Thu Jun 1 03:22:00 EDT 2017


    [ https://issues.jboss.org/browse/CDI-703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13414719#comment-13414719 ] 

Matej Novotny commented on CDI-703:
-----------------------------------

[~struberg] but that's the whole point of [transitive relation|https://en.wikipedia.org/wiki/Transitive_relation]. Indirect specialization is defined through transitive relation, in gibberish that is   ∀ a , b , c ∈ X : ( a R b ∧ b R c ) ⇒ a R c

And the very next part of spec follows up on this and mentions the qualifiers:
bq. Then X will inherit the qualifiers and bean name of Y: ...
The word *then* referes to 'when X specializes Y' from the previous paragraph.

So let's have a following chain of beans:

{code}
@QualifierA
class A{...}


@QualifierB
@Specializes
class B extends A{...}


@QualifierC
@Specializes
class C extends B{...}
{code}

Now all that is needed is to substitute {{X}} and {{Y}} (from spec statements) for beans and explore how the transitive relation affects this.
There are two statements:
a) Formally, a bean X is said to specialize another bean Y if there is either:  -> true if specialization exists
b) Then X will inherit the qualifiers and bean name of Y: -> true if a) is true

Now let's apply this to the above shown beans:
* Bean A
** Nothing interesting, the basic bean which will be replaced
* Bean B
** Direct specialization of A
*** X=B, Y=A
*** a) true, specialization exists
*** b) true, qualifier {{@QualifierA}} is inherited
* Bean C
** Direct specialization of B (also defined in spec in [chapter 3.1.4|http://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#specialize_managed_bean]
*** X=C, Y=B
*** a) true, specialization exists
*** b) true, qualifier {{@QualifierB}} is inherited
** Indirect specialization of A
*** Implied by transitive relation, if C specializes B and B specializes A, then C specializes A
*** Therefore X=C, Y=A
*** a) true, indirect specialization exists
*** b) since a) is valid, this hold true *and C has to inherit qualifier {{@QualifierA}}* from A

> Carify indirect specialization
> ------------------------------
>
>                 Key: CDI-703
>                 URL: https://issues.jboss.org/browse/CDI-703
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>          Components: Inheritance and Specialization
>    Affects Versions: 2.0 .Final
>            Reporter: Antoine Sabot-Durand
>
> Indirect specialization in chapter 4.3.1 lacks clarification regarding intermediate beans attributes (qualifier and name) on specializing bean bean.
> Discussion in CDITCK-580 illustrates this concern.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)



More information about the cdi-dev mailing list