Martin Desruisseaux created SIS-567:
---------------------------------------
Summary: Resolve serialization compiler warnings
Key: SIS-567
URL: https://issues.apache.org/jira/browse/SIS-567
Project: Spatial Information Systems
Issue Type: Task
Components: Metadata, Referencing, Storage, Utilities
Reporter: Martin Desruisseaux
Assignee: Martin Desruisseaux
Fix For: 1.4
Since Java 18, the compiler emit the following warnings on many fields,
especially in metadata and referencing modules:
{quote}
Non-transient instance field of a serializable class declared with a
non-serializable type.
{quote}
In a lot of cases, the field type is an interface where all implementations
used in practice are serializable. We resolve those warnings with the following
annotation:
{code:java}
@SuppressWarnings("serial") // Most SIS implementations are
serializable.
{code}
In a few cases the value can be anything (e.g. type of values in a collection).
We use the following annotation for them.
{code:java}
@SuppressWarnings("serial") // Not statically typed as Serializable.
{code}
Finally there is a few classes where we could not yet resolve the warning:
* {{org.apache.sis.internal.util.StandardDateFormat}} has a
{{java.time.format.DateTimeFormatter}} field, which is not serializable.
* {{org.apache.sis.internal.referencing.provider.DatumShiftGridFile}} has a
{{java.nio.file.Path}} field.
* {{org.apache.sis.gui.dataset.ResourceEvent}} has a {{java.nio.file.Path}}
field.
For the later two, maybe {{Path}} could be replaced by {{URI}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)