< prev index next >

src/java.base/share/classes/java/util/TreeMap.java

Print this page

        

@@ -116,10 +116,11 @@
      * The comparator used to maintain order in this tree map, or
      * null if it uses the natural ordering of its keys.
      *
      * @serial
      */
+    @SuppressWarnings("serial") // Not statically typed as Serializable
     private final Comparator<? super K> comparator;
 
     private transient Entry<K,V> root;
 
     /**

@@ -1351,11 +1352,14 @@
          * true, then the low (absolute) bound is the start of the
          * backing map, and the other values are ignored. Otherwise,
          * if loInclusive is true, lo is the inclusive bound, else lo
          * is the exclusive bound. Similarly for the upper bound.
          */
-        final K lo, hi;
+        @SuppressWarnings("serial") // Not statically typed as Serializable
+        final K lo;
+        @SuppressWarnings("serial") // Not statically typed as Serializable
+        final K hi;
         final boolean fromStart, toEnd;
         final boolean loInclusive, hiInclusive;
 
         NavigableSubMap(TreeMap<K,V> m,
                         boolean fromStart, K lo, boolean loInclusive,

@@ -1934,10 +1938,11 @@
                         boolean fromStart, K lo, boolean loInclusive,
                         boolean toEnd,     K hi, boolean hiInclusive) {
             super(m, fromStart, lo, loInclusive, toEnd, hi, hiInclusive);
         }
 
+        @SuppressWarnings("serial") // Not statically typed as Serializable
         private final Comparator<? super K> reverseComparator =
             Collections.reverseOrder(m.comparator);
 
         public Comparator<? super K> comparator() {
             return reverseComparator;

@@ -2022,11 +2027,14 @@
     private class SubMap extends AbstractMap<K,V>
         implements SortedMap<K,V>, java.io.Serializable {
         @java.io.Serial
         private static final long serialVersionUID = -6520786458950516097L;
         private boolean fromStart = false, toEnd = false;
-        private K fromKey, toKey;
+        @SuppressWarnings("serial") // Not statically typed as Serializable
+        private K fromKey;
+        @SuppressWarnings("serial") // Not statically typed as Serializable
+        private K toKey;
         @java.io.Serial
         private Object readResolve() {
             return new AscendingSubMap<>(TreeMap.this,
                                          fromStart, fromKey, true,
                                          toEnd, toKey, false);
< prev index next >