JDK 9 RFR of JDK-8036568: Serial incompatibility in java.util.TreeMap.NavigableSubMap

Joe Darcy joe.darcy at oracle.com
Wed Mar 5 01:44:57 UTC 2014


Hello,

Following up from the recent discussions around

     JDK-8035452: Fix serial lint warnings in core libs

it turns out that java.util.TreeMap.NavigableSubMap, a package private 
nested class used in the TreeMap implementation does indeed need to have 
a serialVersionUID defined to allow for easy cross-release serialization.

An API change made to TreeMap during JDK 8 changed the serialver hash of 
the class. This patch

--- a/src/share/classes/java/util/TreeMap.java    Mon Mar 03 18:17:00 
2014 +0400
+++ b/src/share/classes/java/util/TreeMap.java    Tue Mar 04 17:41:09 
2014 -0800
@@ -1,5 +1,5 @@
  /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights 
reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights 
reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
@@ -1335,6 +1335,7 @@
       */
      abstract static class NavigableSubMap<K,V> extends AbstractMap<K,V>
          implements NavigableMap<K,V>, java.io.Serializable {
+        private static final long serialVersionUID = -2102997345730753016L;
          /**
           * The backing map.
           */

restores the serial hash value present in JDK 6 and 7.

This particular review request is for JDK 9; we are evaluating options 
on how best to fix this issue in the JDK 8 train.

Thanks,

-Joe



More information about the core-libs-dev mailing list