You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Karol Lewandowski (Jira)" <ji...@apache.org> on 2022/09/25 18:18: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 ]
Karol Lewandowski updated SLING-11595:
--------------------------------------
Description:
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
was:
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:
* <link TODO>
PR created:
* <link TODO>
> 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
> Priority: Major
> Time Spent: 10m
> 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)