Uploaded image for project: 'Spatial Information Systems'
  1. Spatial Information Systems
  2. SIS-567

Resolve serialization compiler warnings

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 1.0, 1.1, 1.2, 1.3
    • 1.4
    • None

    Description

      Since Java 18, the compiler emit the following warnings on many fields, especially in metadata and referencing modules:

      Non-transient instance field of a serializable class declared with a non-serializable type.

      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:

      @SuppressWarnings("serial")         // Most SIS implementations are serializable.
      

      In a few cases the value can be anything (e.g. type of values in a collection). We use the following annotation for them.

      @SuppressWarnings("serial")         // Not statically typed as Serializable.
      

      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.

      Attachments

        Issue Links

          Activity

            People

              desruisseaux Martin Desruisseaux
              desruisseaux Martin Desruisseaux
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: