Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-11595

Incorrect injectionStrategy Javadocs

    XMLWordPrintableJSON

Details

    Description

      It seems that all docs for injectionStrategy in injector annotations are incorrect.

      The current docs:

      /**
       * 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.
       */ 

      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:

      I added a new test case:

      PR created:

      Attachments

        Activity

          People

            sseifert Stefan Seifert
            karol.lewandowski Karol Lewandowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m