You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (Jira)" <ji...@apache.org> on 2023/03/28 09:38:00 UTC

[jira] [Updated] (SLING-11595) Incorrect injectionStrategy Javadocs

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

Stefan Seifert updated SLING-11595:
-----------------------------------
    Fix Version/s: Models API 1.4.4
                   Models Implementation 1.5.6

thanks for the contribution!

[https://github.com/apache/sling-org-apache-sling-models-api/commit/ee6260f7f7ae56842ae06ae40296d73061cdf15c]

https://github.com/apache/sling-org-apache-sling-models-impl/commit/2d0f287885285b9317766b2af28e9c5e0a0e4d91

> 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
>             Fix For: Models API 1.4.4, Models Implementation 1.5.6
>
>          Time Spent: 40m
>  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)