You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2023/01/15 10:09:07 UTC

[sis] 01/01: Document `StandardDateFormat` as not intended for serialization. We verified that it was not used as non-transient field in a serialiable class.

This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit f8afbbfd5b0194b86e07c6999eb346dd299c1336
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sun Jan 15 11:06:35 2023 +0100

    Document `StandardDateFormat` as not intended for serialization.
    We verified that it was not used as non-transient field in a serialiable class.
    
    https://issues.apache.org/jira/browse/SIS-567
---
 .../org/apache/sis/internal/util/StandardDateFormat.java    | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java
index 8664a042b7..db27b990a7 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java
@@ -62,16 +62,17 @@ import org.apache.sis.util.CharSequences;
  * only hours, or only hours and minutes, <i>etc</i>. ISO 19162 said that the timezone is restricted to UTC
  * but nevertheless allows to specify a timezone.</p>
  *
+ * <h2>Serialization</h2>
+ * Despite inheriting the {@link java.io.Serializable} interface, this class is actually not serializable
+ * because the {@link #format} field is not serializable (a constraint of {@link java.time.format}).
+ * All usages in Apache SIS should be either in transient fields or in non-serializable classes.
+ *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.1
+ * @version 1.4
  * @since   0.6
  */
+@SuppressWarnings("serial")     // Not intended to be serialized.
 public final class StandardDateFormat extends DateFormat {
-    /**
-     * For cross-version compatibility.
-     */
-    private static final long serialVersionUID = 2764313272939921664L;
-
     /**
      * The {@value} timezone ID.
      *