--- old/src/share/classes/java/util/TreeSet.java 2011-12-03 15:58:05.360387916 +0100 +++ new/src/share/classes/java/util/TreeSet.java 2011-12-03 15:58:05.221387931 +0100 @@ -302,7 +302,7 @@ m instanceof TreeMap) { SortedSet set = (SortedSet) c; TreeMap map = (TreeMap) m; - Comparator cc = (Comparator) set.comparator(); + Comparator cc = set.comparator(); Comparator mc = map.comparator(); if (cc==mc || (cc != null && cc.equals(mc))) { map.addAllForTreeSet(set, PRESENT); @@ -469,8 +469,9 @@ * * @return a shallow copy of this set */ + @SuppressWarnings("unchecked") public Object clone() { - TreeSet clone = null; + TreeSet clone; try { clone = (TreeSet) super.clone(); } catch (CloneNotSupportedException e) { @@ -519,14 +520,11 @@ s.defaultReadObject(); // Read in Comparator - Comparator c = (Comparator) s.readObject(); + @SuppressWarnings("unchecked") + Comparator c = (Comparator) s.readObject(); // Create backing TreeMap - TreeMap tm; - if (c==null) - tm = new TreeMap<>(); - else - tm = new TreeMap<>(c); + TreeMap tm = new TreeMap<>(c); m = tm; // Read in size