Martin Desruisseaux created SIS-566:
---------------------------------------

             Summary: Remove instantiation of primitive wrappers
                 Key: SIS-566
                 URL: https://issues.apache.org/jira/browse/SIS-566
             Project: Spatial Information Systems
          Issue Type: Task
          Components: Metadata
    Affects Versions: 1.3, 1.2, 1.1, 1.0, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3
            Reporter: Martin Desruisseaux
             Fix For: 1.4


In the {{org.apache.sis.xml.NilReason}} class, the private 
{{createNilPrimitive(Class)]] method instantiate new {{Boolean}}, {{Byte}}, 
{{Short}}, {{Integer}}, {{Long}}, {{Float}} or {{Double}} object by invoking 
directly their constructor. The {{valueOf(…)}} method can not be used in this 
context, because we really need new instances. They are used for identifying a 
particular instances as a nil object.

This pattern will soon not work anymore, because those primitive wrappers will 
become _value object_. The constructors that we are invoking will be removed, 
and the identity comparison that we rely on will not work anymore.

I'm not aware of a complete substitute for the functionality. We may loose the 
capability to flag some `Integer` values as "nil value". Possible alternatives 
may be:

* For values that are supposed to be measurements, use 
{{javax.measure.Quantity}} instead.
* For other kind of values, use {{Number}} instead. A good side effect is to 
allow the use of {{BigInteger}} or {{BigDecimal}} if the implementation wants 
to do so.




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

Reply via email to