Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Sling Models Implementation 1.0.2, Sling Models Implementation 1.0.4
-
None
Description
Currently all default annotations on numeric types lead to the following warning:
org.apache.sling.models.impl.ModelAdapterFactory Default values for class java.lang.Boolean are not supported and the default is not used.
This is due to the fact that first all types are converted from Primitives to Object Wrapper Classes (in mapPrimitiveClasses). Then the comparison against that type only considers Primitives (in getDefaultValue, except for Strings), which obviously failed, because either those were Object Wrapper Classes right from the beginning, or they were converted to those.
In my regard you should compare the Type against e.g. Integer.class instead of Integer.TYPE (ModelAdapterFactory, line 428ff). Otherwise defaults for numerical types will not work.
Attachments
Issue Links
- is duplicated by
-
SLING-3789 Default annotation only works with String
- Resolved