[
https://issues.apache.org/jira/browse/SLING-4155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14207799#comment-14207799
]
Konrad Windszus commented on SLING-4155:
----------------------------------------
Actually it is not that simple because:
annotations only allow {{boolean}} but not {{Boolean}}
(http://stackoverflow.com/questions/1458535/which-types-can-be-used-for-java-annotation-members)
and also null is not allowed as a default value
(http://stackoverflow.com/questions/1178104/error-setting-a-default-null-value-for-an-annotations-field).
Therefore I propose the following (not backwards-compatible!!!) change about
all injector specific annotations.
Instead of having a {{boolean}} field {{optional}} we should rely on an
{{enum}} with the following three allowed values: {{TRUE, FALSE, DEFAULT}}.
The default should be {{DEFAULT}} in which case the DefaultInjectionStrategy is
used.
I would propose not adding a new attribute for that, because the previous
definition of the field {{optional}} does just not behave correctly if a
DefaultInjectionStrategy is used. WDYT?
> DefaultInjectionStrategy does not support injector-specific annotations
> -----------------------------------------------------------------------
>
> Key: SLING-4155
> URL: https://issues.apache.org/jira/browse/SLING-4155
> Project: Sling
> Issue Type: Bug
> Components: Extensions
> Affects Versions: Sling Models Implementation 1.0.6
> Reporter: Konrad Windszus
>
> The default injection strategy (being implemented in SLING-3696) is only
> considered, in case there is no injector-specific annotation being used.
> Otherwise it is just ignored.
> The logic should be like this:
> if annotationProcessor.isOptional() returns null
> -> the default injection strategy should be used
> in any other case the boolean value should be used.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)