Karol Lewandowski created SLING-11595:
-----------------------------------------

             Summary: 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


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>



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

Reply via email to