[ 
https://issues.apache.org/jira/browse/SLING-11595?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Seifert reassigned SLING-11595:
--------------------------------------

    Assignee: Stefan Seifert

> Incorrect injectionStrategy Javadocs
> ------------------------------------
>
>                 Key: SLING-11595
>                 URL: https://issues.apache.org/jira/browse/SLING-11595
>             Project: Sling
>          Issue Type: Bug
>          Components: Sling Models
>    Affects Versions: Models API 1.4.2
>            Reporter: Karol Lewandowski
>            Assignee: Stefan Seifert
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> It seems that all docs for {{injectionStrategy}} in injector annotations are 
> incorrect.
> The current docs:
> {code:java}
> /**
>  * if set to REQUIRED injection is mandatory, if set to OPTIONAL injection is 
> optional, in case of DEFAULT 
>  * the standard annotations ({@link 
> org.apache.sling.models.annotations.Optional}, {@link 
> org.apache.sling.models.annotations.Required}) are used.
>  * If even those are not available the default injection strategy defined on 
> the {@link org.apache.sling.models.annotations.Model} applies.
>  * Default value = DEFAULT.
>  */ {code}
> state that {{@Optional}} and {{@Required}} are used only if 
> {{{}injectionStrategy = DEFAULT{}}}. *It is not true, as these annotations 
> take precedence over {{{}injectionStrategy{}}}.*
> It is confirmed by implementation of 
> {{{}org.apache.sling.models.impl.model.AbstractInjectableElement{}}}, but 
> also by test:
>  * 
> [https://github.com/apache/sling-org-apache-sling-models-impl/blob/master/src/test/java/org/apache/sling/models/impl/AnnotationConflictsTest.java#L220:L240]
> I added a new test case:
>  * https://github.com/apache/sling-org-apache-sling-models-impl/pull/38
> PR created:
>  * https://github.com/apache/sling-org-apache-sling-models-api/pull/7



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to