From 5a1dcb13eaa6040be54cf3bc6772470a397b2c79 Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Fri, 18 Mar 2016 20:29:35 +0000 Subject: Cleanup warnings in java.util.Collections. 2016-03-18 Andrew John Hughes Cleanup warnings in java.util.Collections. * java/util/Collections.java: (EMPTY_SET): Suppress warnings generated by this legacy raw type. (EMPTY_LIST): Likewise. (EMPTY_MAP): Likewise. (compare(T, T, Comparator): Suppress warning generated by casting to Comparable. (binarySearch(List, Comparator)): Remove unneeded casts. (reverse(List)): Suppress warnings when casting to ListIterator. Cast is necessary as lists are modified. (reverseOrder(Comparator)): Return reverseOrder() rather than rcInstance. (reverseOrder()): Create appropriately typed ReverseComparator rather than using set instance. (rcInstance): Removed. (ReverseComparator.compare(T,T)): Suppress warnings from casting to Comparable. (rotate(List,int)): Suppress warnings when casting to List. Cast is necessary to modify list. (shuffle(List,Random)): Likewise. (disjoint(Collection,Collection)): Remove unnecessary casting. (sort(List,Comparator)): Suppress warnings when casting the returned array. Arrays of a generic type can not be created. (swap(List,int,int)): Suppress warnings when casting list to List. This is necessary to use the set method. (entrySet().SynchronizedMapEntry): Type should not have its own type parameters which hide those of the map. (entrySet().SynchronizedSet.iterator()): Remove type parameters from SynchronizedMapEntry creation. (UnmodifiableList.list): Retain input type parameter so as to avoid casting. (UnmodifiableList.UnmodifiableList): Remove cast. (UnmodifiableList.li): Retain input type parameter so as to avoid casting. (UnmodifiableListIterator(ListIterator)): Likewise. (UnmodifiableMap(Map)): Suppress warnings from casting down to Map. (UnmodifiableMap.entrySet()): Remove type parameters from UnmodifiableEntrySet creation. (UnmodifiableMap.UnmodifiableEntrySet): Remove type parameters and make instance-specific so we can use the UnmodifiableMap's type parameters. (UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableMapEntry): Likewise. (UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableMapEntry.e): Retain input type parameters so as to avoid casting. (UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableMapEntry.UnmodifiableMapEntry(Map.Entry)): Likewise. (UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableEntrySet(Set)): Likewise. (UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableIterator.next()): Remove type parameters from UnmodifiableMapEntry creation. (UnmodifiableMap.toArray()): Likewise and improve method structure. (UnmodifiableMap.toArray(S[])): Remove type parameters from UnmodifiableMapEntry and suppress warnings from casting array members. (UnmodifiableSortedMap.sm): Retain input type parameters so as to avoid casting. (UnmodifiableSortedMap.UnmodifiableSortedMap(SortedMap)): Remove cast. (CheckedList.addAll(int,Collection)): Replace iterator with for-each loop, removing the need for casting. (CheckedMap.entrySet()): Remove type parameters from CheckedEntrySet creation and klass argument. (CheckedMap.CheckedEntrySet): Don't create additional type parameters, use those of the containing map as a instance class, not a static class. (keyType): Type should be K to match enclosing CheckedMap. (valueType): Type should be V to match enclosing CheckedMap. (CheckedMap.CheckedEntrySet.CheckedEntrySet(Set,Class,Class)): Suppress warnings when casting Map.Entry class. (CheckedMap.CheckedEntrySet.iterator()): Make return type Map.Entry and create corresponding CheckedIterator instance. (CheckedMap.CheckedEntrySet.CheckedIterator.next()): Likewise with Map.Entry instance. (CheckedMap.CheckedEntrySet.CheckedIterator.Map.Entry.getKey()): Make return type K. (CheckedMap.CheckedEntrySet.CheckedIterator.Map.Entry.getValue()): Make return type V. (CheckedMap.CheckedEntrySet.CheckedIterator.Map.Entry.setValue(Object)): Likewise. (CheckedMap.putAll(Map)): Use for-each loop instead of Iterator, avoiding casting. --- ChangeLog | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index f5221bd84..0d41d6c8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,95 @@ +2016-03-18 Andrew John Hughes + + * java/util/Collections.java: + (EMPTY_SET): Suppress warnings generated by this + legacy raw type. + (EMPTY_LIST): Likewise. + (EMPTY_MAP): Likewise. + (compare(T, T, Comparator): Suppress warning + generated by casting to Comparable. + (binarySearch(List, Comparator)): Remove unneeded + casts. + (reverse(List)): Suppress warnings when casting + to ListIterator. Cast is necessary as + lists are modified. + (reverseOrder(Comparator)): Return reverseOrder() + rather than rcInstance. + (reverseOrder()): Create appropriately typed + ReverseComparator rather than using set instance. + (rcInstance): Removed. + (ReverseComparator.compare(T,T)): Suppress warnings + from casting to Comparable. + (rotate(List,int)): Suppress warnings when casting + to List. Cast is necessary to modify list. + (shuffle(List,Random)): Likewise. + (disjoint(Collection,Collection)): Remove unnecessary + casting. + (sort(List,Comparator)): Suppress warnings when casting + the returned array. Arrays of a generic type can not + be created. + (swap(List,int,int)): Suppress warnings when casting + list to List. This is necessary to use the + set method. + (entrySet().SynchronizedMapEntry): Type should not have its + own type parameters which hide those of the map. + (entrySet().SynchronizedSet.iterator()): Remove type + parameters from SynchronizedMapEntry creation. + (UnmodifiableList.list): Retain input type parameter + so as to avoid casting. + (UnmodifiableList.UnmodifiableList): Remove cast. + (UnmodifiableList.li): Retain input type parameter + so as to avoid casting. + (UnmodifiableListIterator(ListIterator)): Likewise. + (UnmodifiableMap(Map)): Suppress warnings from casting + down to Map. + (UnmodifiableMap.entrySet()): Remove type parameters + from UnmodifiableEntrySet creation. + (UnmodifiableMap.UnmodifiableEntrySet): Remove type + parameters and make instance-specific so we can + use the UnmodifiableMap's type parameters. + (UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableMapEntry): + Likewise. + (UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableMapEntry.e): + Retain input type parameters so as to avoid casting. + (UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableMapEntry.UnmodifiableMapEntry(Map.Entry)): + Likewise. + (UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableEntrySet(Set)): + Likewise. + (UnmodifiableMap.UnmodifiableEntrySet.UnmodifiableIterator.next()): + Remove type parameters from UnmodifiableMapEntry creation. + (UnmodifiableMap.toArray()): Likewise and improve method + structure. + (UnmodifiableMap.toArray(S[])): Remove type parameters from + UnmodifiableMapEntry and suppress warnings from casting + array members. + (UnmodifiableSortedMap.sm): Retain input type parameters + so as to avoid casting. + (UnmodifiableSortedMap.UnmodifiableSortedMap(SortedMap)): + Remove cast. + (CheckedList.addAll(int,Collection)): Replace iterator with for-each + loop, removing the need for casting. + (CheckedMap.entrySet()): Remove type parameters from CheckedEntrySet + creation and klass argument. + (CheckedMap.CheckedEntrySet): Don't create additional + type parameters, use those of the containing map as + a instance class, not a static class. + (keyType): Type should be K to match enclosing CheckedMap. + (valueType): Type should be V to match enclosing CheckedMap. + (CheckedMap.CheckedEntrySet.CheckedEntrySet(Set,Class,Class)): + Suppress warnings when casting Map.Entry class. + (CheckedMap.CheckedEntrySet.iterator()): Make return type + Map.Entry and create corresponding CheckedIterator instance. + (CheckedMap.CheckedEntrySet.CheckedIterator.next()): Likewise + with Map.Entry instance. + (CheckedMap.CheckedEntrySet.CheckedIterator.Map.Entry.getKey()): + Make return type K. + (CheckedMap.CheckedEntrySet.CheckedIterator.Map.Entry.getValue()): + Make return type V. + (CheckedMap.CheckedEntrySet.CheckedIterator.Map.Entry.setValue(Object)): + Likewise. + (CheckedMap.putAll(Map)): Use for-each loop instead of Iterator, + avoiding casting. + 2016-01-04 Andrew John Hughes Cleanup warnings in gnu.xml.transform.* and -- cgit v1.2.1