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

Stefan Seifert reopened SLING-3863:
-----------------------------------


hmm, but with the changes to the implementation that patch is no longer correct 
and breaks existing behavior - if the fields use the wrapper instead of the 
primitive type it's initialized with 0 and not null when missing and optional.

attached is a patch that updates the unit tests that show the problematic 
behavior.
[^140820_SLING-3863_additional_unit_tests.patch]

> Sling Models: Injections fails for optional primitive types without default 
> values
> ----------------------------------------------------------------------------------
>
>                 Key: SLING-3863
>                 URL: https://issues.apache.org/jira/browse/SLING-3863
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: Sling Models Implementation 1.0.6
>            Reporter: Stefan Seifert
>            Assignee: Justin Edelson
>            Priority: Minor
>              Labels: models
>             Fix For: Sling Models Implementation 1.0.8
>
>         Attachments: 140820_SLING-3863_primitives_optional.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> Sling models injections for interfaces and constructor fails if:
> * the type to inject is a primitive type
> * its marked as optional
> * and there is no value to inject
> in this case it is tried to inject null which fails because null is not 
> allowed for a primitive.
> patch attached.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to