OpenJDK / portola / portola
changeset 47730:c7b5b1ce8145
8189764: Miscellaneous changes imported from jsr166 CVS 2017-11
Reviewed-by: martin, psandoz, dholmes
line wrap: on
line diff
--- a/test/jdk/java/util/AbstractList/FailFastIterator.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/AbstractList/FailFastIterator.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4189896 * @summary AbstractList iterators previously checked for co-modification
--- a/test/jdk/java/util/AbstractSequentialList/AddAll.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/AbstractSequentialList/AddAll.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4295163 * @summary AddAll(int, Collection) intersperses the Collection with this List.
--- a/test/jdk/java/util/Collection/IteratorMicroBenchmark.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collection/IteratorMicroBenchmark.java Thu Nov 09 16:14:45 2017 -0800 @@ -233,7 +233,7 @@ } // Checks for correctness *and* prevents loop optimizations - class Check { + static class Check { private int sum; public void sum(int sum) { if (this.sum == 0)
--- a/test/jdk/java/util/Collection/MOAT.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collection/MOAT.java Thu Nov 09 16:14:45 2017 -0800 @@ -1584,11 +1584,11 @@ } interface Fun {void f() throws Throwable;} private static void THROWS(Class<? extends Throwable> k, Fun... fs) { - for (Fun f : fs) - try { f.f(); fail("Expected " + k.getName() + " not thrown"); } - catch (Throwable t) { - if (k.isAssignableFrom(t.getClass())) pass(); - else unexpected(t);}} + for (Fun f : fs) + try { f.f(); fail("Expected " + k.getName() + " not thrown"); } + catch (Throwable t) { + if (k.isAssignableFrom(t.getClass())) pass(); + else unexpected(t);}} static byte[] serializedForm(Object obj) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream();
--- a/test/jdk/java/util/Collection/RemoveMicroBenchmark.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collection/RemoveMicroBenchmark.java Thu Nov 09 16:14:45 2017 -0800 @@ -230,7 +230,7 @@ } // Checks for correctness *and* prevents loop optimizations - class Check { + static class Check { private int sum; public void sum(int sum) { if (this.sum == 0)
--- a/test/jdk/java/util/Collections/AddAll.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/AddAll.java Thu Nov 09 16:14:45 2017 -0800 @@ -33,7 +33,7 @@ public class AddAll { static final int N = 100; - public static void main(String args[]) { + public static void main(String[] args) { test(new ArrayList<Integer>()); test(new LinkedList<Integer>()); test(new HashSet<Integer>());
--- a/test/jdk/java/util/Collections/BinarySearchNullComparator.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/BinarySearchNullComparator.java Thu Nov 09 16:14:45 2017 -0800 @@ -30,7 +30,7 @@ import java.util.*; public class BinarySearchNullComparator { - public static void main(String args[]) throws Exception { + public static void main(String[] args) throws Exception { List list = Arrays.asList(new String[] {"I", "Love", "You"}); int result = Collections.binarySearch(list, "You", null);
--- a/test/jdk/java/util/Collections/CheckedListBash.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/CheckedListBash.java Thu Nov 09 16:14:45 2017 -0800 @@ -209,15 +209,14 @@ } static void AddRandoms(List s, int n) { - for (int i=0; i<n; i++) { - int r = rnd.nextInt() % n; - Integer e = new Integer(r < 0 ? -r : r); + for (int i = 0; i < n; i++) { + Integer e = rnd.nextInt(n); int preSize = s.size(); if (!s.add(e)) fail("Add failed."); int postSize = s.size(); - if (postSize-preSize != 1) + if (postSize - preSize != 1) fail("Add didn't increase size by 1."); } }
--- a/test/jdk/java/util/Collections/CheckedMapBash.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/CheckedMapBash.java Thu Nov 09 16:14:45 2017 -0800 @@ -36,7 +36,6 @@ import org.testng.annotations.DataProvider; import static org.testng.Assert.fail; -import static org.testng.Assert.assertTrue; public class CheckedMapBash { static final Random rnd = new Random();
--- a/test/jdk/java/util/Collections/CheckedSetBash.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/CheckedSetBash.java Thu Nov 09 16:14:45 2017 -0800 @@ -122,9 +122,8 @@ } static void AddRandoms(Set s, int n) { - for (int i=0; i<n; i++) { - int r = rnd.nextInt() % n; - Integer e = new Integer(r < 0 ? -r : r); + for (int i = 0; i < n; i++) { + Integer e = rnd.nextInt(n); int preSize = s.size(); boolean prePresent = s.contains(e);
--- a/test/jdk/java/util/Collections/Disjoint.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/Disjoint.java Thu Nov 09 16:14:45 2017 -0800 @@ -34,7 +34,7 @@ public class Disjoint { static final int N = 20; - public static void main(String args[]) { + public static void main(String[] args) { // Make an array of lists each of which shares a single element // with its "neighbors," and no elements with other lists in the array Random rnd = new Random();
--- a/test/jdk/java/util/Collections/EmptyNavigableMap.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/EmptyNavigableMap.java Thu Nov 09 16:14:45 2017 -0800 @@ -48,7 +48,7 @@ public class EmptyNavigableMap { public static <T> void assertInstance(T actual, Class<? extends T> expected) { - assertInstance(expected.isInstance(actual), null); + assertInstance(actual, expected, null); } public static <T> void assertInstance(T actual, Class<? extends T> expected, String message) {
--- a/test/jdk/java/util/Collections/EmptyNavigableSet.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/EmptyNavigableSet.java Thu Nov 09 16:14:45 2017 -0800 @@ -50,7 +50,7 @@ public class EmptyNavigableSet { public static <T> void assertInstance(T actual, Class<? extends T> expected) { - assertInstance(expected.isInstance(actual), null); + assertInstance(actual, expected, null); } public static <T> void assertInstance(T actual, Class<? extends T> expected, String message) {
--- a/test/jdk/java/util/Collections/Enum.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/Enum.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4323074 * @summary Basic test for new Enumeration -> List converter
--- a/test/jdk/java/util/Collections/FindSubList.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/FindSubList.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4323074 * @summary Basic test for Collections.indexOfSubList/lastIndexOfSubList @@ -33,8 +33,8 @@ public static void main(String[] args) throws Exception { int N = 500; List source = new ArrayList(3 * N); - List target[]= new List[N+1]; - int index[] = new int[N+1]; + List[] target = new List[N+1]; + int[] index = new int[N+1]; for (int i=0; i<=N; i++) { List t = new ArrayList(); String s = Integer.toString(i, 2); @@ -50,8 +50,12 @@ } } - List src[] = {source, new LinkedList(source), new Vector(source), - Arrays.asList(source.toArray())}; + List[] src = { + source, + new LinkedList(source), + new Vector(source), + Arrays.asList(source.toArray()) + }; for (int j=0; j<src.length; j++) { List s = src[j]; @@ -75,8 +79,12 @@ if (i != N) index[i] = srcSize - index[i] - target[i].size(); } - List src2[] = {source, new LinkedList(source), new Vector(source), - Arrays.asList(source.toArray())}; + List[] src2 = { + source, + new LinkedList(source), + new Vector(source), + Arrays.asList(source.toArray()) + }; for (int j=0; j<src2.length; j++) { List s = src2[j];
--- a/test/jdk/java/util/Collections/Frequency.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/Frequency.java Thu Nov 09 16:14:45 2017 -0800 @@ -32,7 +32,7 @@ public class Frequency { static final int N = 100; - public static void main(String args[]) { + public static void main(String[] args) { test(new ArrayList<Integer>()); test(new LinkedList<Integer>()); }
--- a/test/jdk/java/util/Collections/NullComparator.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/NullComparator.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4224271 * @summary A null Comparator is now specified to indicate natural ordering. @@ -37,7 +37,7 @@ List sorted = new ArrayList(list); Collections.shuffle(list); - Object a[] = list.toArray(); + Object[] a = list.toArray(); Arrays.sort(a, null); if (!Arrays.asList(a).equals(sorted)) throw new Exception("Arrays.sort");
--- a/test/jdk/java/util/Collections/ReplaceAll.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/ReplaceAll.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4323074 * @summary Basic test for new replaceAll algorithm @@ -33,7 +33,7 @@ static final int SIZE = 20; public static void main(String[] args) throws Exception { - List a[] = {new ArrayList(), new LinkedList(), new Vector()}; + List[] a = {new ArrayList(), new LinkedList(), new Vector()}; for (int i=0; i<a.length; i++) { List lst = a[i];
--- a/test/jdk/java/util/Collections/Rotate.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/Rotate.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4323074 * @summary Basic test for new rotate algorithm @@ -37,7 +37,7 @@ static Random rnd = new Random(); public static void main(String[] args) throws Exception { - List a[] = {new ArrayList(), new LinkedList(), new Vector()}; + List[] a = {new ArrayList(), new LinkedList(), new Vector()}; for (int i=0; i<a.length; i++) { List lst = a[i];
--- a/test/jdk/java/util/Collections/RotateEmpty.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/RotateEmpty.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4389747 * @summary Collections.rotate(...) returns ArithmeticException
--- a/test/jdk/java/util/Collections/Ser.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/Ser.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4190323 * @summary EMPTY_SET, EMPTY_LIST, and the collections returned by
--- a/test/jdk/java/util/Collections/Swap.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/Swap.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4323074 * @summary Basic test for newly public swap algorithm
--- a/test/jdk/java/util/Collections/ViewSynch.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/ViewSynch.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4268780 * @summary Collection-views of submap-views of synchronized-views of
--- a/test/jdk/java/util/Collections/WrappedNull.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Collections/WrappedNull.java Thu Nov 09 16:14:45 2017 -0800 @@ -31,152 +31,152 @@ import java.util.*; public class WrappedNull { - public static void main(String argv[]) throws Exception { - boolean testSucceeded = false; - try { - List l = Arrays.asList(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("Arrays.asList"); + public static void main(String[] args) throws Exception { + boolean testSucceeded = false; + try { + List l = Arrays.asList(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("Arrays.asList"); - testSucceeded = false; - try { - Collection c = Collections.unmodifiableCollection(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("unmodifiableCollection"); + testSucceeded = false; + try { + Collection c = Collections.unmodifiableCollection(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("unmodifiableCollection"); - testSucceeded = false; - try { - Set c = Collections.unmodifiableSet(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("unmodifiableSet"); + testSucceeded = false; + try { + Set c = Collections.unmodifiableSet(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("unmodifiableSet"); - testSucceeded = false; - try { - List c = Collections.unmodifiableList(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("unmodifiableList"); + testSucceeded = false; + try { + List c = Collections.unmodifiableList(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("unmodifiableList"); - testSucceeded = false; - try { - Map c = Collections.unmodifiableMap(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("unmodifiableMap"); + testSucceeded = false; + try { + Map c = Collections.unmodifiableMap(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("unmodifiableMap"); - testSucceeded = false; - try { - SortedSet c = Collections.unmodifiableSortedSet(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("unmodifiableSortedSet"); + testSucceeded = false; + try { + SortedSet c = Collections.unmodifiableSortedSet(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("unmodifiableSortedSet"); - testSucceeded = false; - try { - SortedMap c = Collections.unmodifiableSortedMap(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("unmodifiableSortedMap"); + testSucceeded = false; + try { + SortedMap c = Collections.unmodifiableSortedMap(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("unmodifiableSortedMap"); - testSucceeded = false; - try { - Collection c = Collections.synchronizedCollection(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("synchronizedCollection"); + testSucceeded = false; + try { + Collection c = Collections.synchronizedCollection(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("synchronizedCollection"); - testSucceeded = false; - try { - Set c = Collections.synchronizedSet(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("synchronizedSet"); + testSucceeded = false; + try { + Set c = Collections.synchronizedSet(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("synchronizedSet"); - testSucceeded = false; - try { - List c = Collections.synchronizedList(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("synchronizedList"); + testSucceeded = false; + try { + List c = Collections.synchronizedList(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("synchronizedList"); - testSucceeded = false; - try { - Map c = Collections.synchronizedMap(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("synchronizedMap"); + testSucceeded = false; + try { + Map c = Collections.synchronizedMap(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("synchronizedMap"); - testSucceeded = false; - try { - SortedSet c = Collections.synchronizedSortedSet(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("synchronizedSortedSet"); + testSucceeded = false; + try { + SortedSet c = Collections.synchronizedSortedSet(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("synchronizedSortedSet"); - testSucceeded = false; - try { - SortedMap c = Collections.synchronizedSortedMap(null); - } - catch (NullPointerException e) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("synchronizedSortedMap"); + testSucceeded = false; + try { + SortedMap c = Collections.synchronizedSortedMap(null); + } + catch (NullPointerException e) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("synchronizedSortedMap"); - // Make sure that non-null arguments don't throw exc. - List l = Arrays.asList(new Object[0]); - Collection c = Collections.unmodifiableCollection( - Collections.EMPTY_SET); - Set s = Collections.unmodifiableSet(Collections.EMPTY_SET); - l = Collections.unmodifiableList(Collections.EMPTY_LIST); - Map m = Collections.unmodifiableMap(Collections.EMPTY_MAP); - SortedSet ss = Collections.unmodifiableSortedSet(new TreeSet()); - SortedMap sm = Collections.unmodifiableSortedMap(new TreeMap()); + // Make sure that non-null arguments don't throw exc. + List l = Arrays.asList(new Object[0]); + Collection c = Collections.unmodifiableCollection( + Collections.EMPTY_SET); + Set s = Collections.unmodifiableSet(Collections.EMPTY_SET); + l = Collections.unmodifiableList(Collections.EMPTY_LIST); + Map m = Collections.unmodifiableMap(Collections.EMPTY_MAP); + SortedSet ss = Collections.unmodifiableSortedSet(new TreeSet()); + SortedMap sm = Collections.unmodifiableSortedMap(new TreeMap()); - c = Collections.synchronizedCollection(Collections.EMPTY_SET); - s = Collections.synchronizedSet(Collections.EMPTY_SET); - l = Collections.synchronizedList(Collections.EMPTY_LIST); - m = Collections.synchronizedMap(Collections.EMPTY_MAP); - ss = Collections.synchronizedSortedSet(new TreeSet()); - sm = Collections.synchronizedSortedMap(new TreeMap()); - } + c = Collections.synchronizedCollection(Collections.EMPTY_SET); + s = Collections.synchronizedSet(Collections.EMPTY_SET); + l = Collections.synchronizedList(Collections.EMPTY_LIST); + m = Collections.synchronizedMap(Collections.EMPTY_MAP); + ss = Collections.synchronizedSortedSet(new TreeSet()); + sm = Collections.synchronizedSortedMap(new TreeMap()); + } }
--- a/test/jdk/java/util/HashMap/KeySetRemove.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/HashMap/KeySetRemove.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4286765 * @summary HashMap and TreeMap entrySet().remove(k) spuriously returned @@ -31,8 +31,8 @@ import java.util.*; public class KeySetRemove { - public static void main(String args[]) throws Exception { - Map m[] = {new HashMap(), new TreeMap()}; + public static void main(String[] args) throws Exception { + Map[] m = {new HashMap(), new TreeMap()}; for (int i=0; i<m.length; i++) { m[i].put("bananas", null); if (!m[i].keySet().remove("bananas"))
--- a/test/jdk/java/util/HashMap/SetValue.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/HashMap/SetValue.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4627516 * @summary HashMap.Entry.setValue() returns new value (as opposed to old) @@ -35,7 +35,7 @@ static final String oldValue = "old"; static final String newValue = "new"; - public static void main(String args[]) throws Exception { + public static void main(String[] args) throws Exception { Map m = new HashMap(); m.put(key, oldValue); Map.Entry e = (Map.Entry) m.entrySet().iterator().next();
--- a/test/jdk/java/util/HashMap/ToString.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/HashMap/ToString.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4189821 * @summary HashMap's entry.toString threw a null pointer exc if the HashMap
--- a/test/jdk/java/util/Hashtable/EqualsCast.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Hashtable/EqualsCast.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4208530 * @summary Hashtable was less robust to extension that it could have been
--- a/test/jdk/java/util/Hashtable/HashCode.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Hashtable/HashCode.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4559052 * @summary Hashtable's hashCode method always returns zero(!)
--- a/test/jdk/java/util/Hashtable/IllegalLoadFactor.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Hashtable/IllegalLoadFactor.java Thu Nov 09 16:14:45 2017 -0800 @@ -34,101 +34,100 @@ */ public class IllegalLoadFactor { - public static void main(String argv[]) throws Exception { - boolean testSucceeded = false; - try { - // this should generate an IllegalArgumentException - Hashtable bad1 = new Hashtable(100, -3); - } - catch (IllegalArgumentException e1) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("Hashtable, negative load factor"); + public static void main(String[] args) throws Exception { + boolean testSucceeded = false; + try { + // this should generate an IllegalArgumentException + Hashtable bad1 = new Hashtable(100, -3); + } + catch (IllegalArgumentException e1) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("Hashtable, negative load factor"); - testSucceeded = false; - try { - // this should generate an IllegalArgumentException - Hashtable bad1 = new Hashtable(100, Float.NaN); - } - catch (IllegalArgumentException e1) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("Hashtable, NaN load factor"); + testSucceeded = false; + try { + // this should generate an IllegalArgumentException + Hashtable bad1 = new Hashtable(100, Float.NaN); + } + catch (IllegalArgumentException e1) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("Hashtable, NaN load factor"); - testSucceeded = false; - try { - // this should generate an IllegalArgumentException - HashMap bad1 = new HashMap(100, -3); - } - catch (IllegalArgumentException e1) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("HashMap, negative load factor"); + testSucceeded = false; + try { + // this should generate an IllegalArgumentException + HashMap bad1 = new HashMap(100, -3); + } + catch (IllegalArgumentException e1) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("HashMap, negative load factor"); - testSucceeded = false; - try { - // this should generate an IllegalArgumentException - HashMap bad1 = new HashMap(100, Float.NaN); - } - catch (IllegalArgumentException e1) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("HashMap, NaN load factor"); + testSucceeded = false; + try { + // this should generate an IllegalArgumentException + HashMap bad1 = new HashMap(100, Float.NaN); + } + catch (IllegalArgumentException e1) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("HashMap, NaN load factor"); - testSucceeded = false; - try { - // this should generate an IllegalArgumentException - HashSet bad1 = new HashSet(100, -3); - } - catch (IllegalArgumentException e1) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("HashSet, negative load factor"); + testSucceeded = false; + try { + // this should generate an IllegalArgumentException + HashSet bad1 = new HashSet(100, -3); + } + catch (IllegalArgumentException e1) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("HashSet, negative load factor"); - testSucceeded = false; - try { - // this should generate an IllegalArgumentException - HashSet bad1 = new HashSet(100, Float.NaN); - } - catch (IllegalArgumentException e1) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("HashSet, NaN load factor"); + testSucceeded = false; + try { + // this should generate an IllegalArgumentException + HashSet bad1 = new HashSet(100, Float.NaN); + } + catch (IllegalArgumentException e1) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("HashSet, NaN load factor"); - testSucceeded = false; - try { - // this should generate an IllegalArgumentException - WeakHashMap bad1 = new WeakHashMap(100, -3); - } - catch (IllegalArgumentException e1) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("WeakHashMap, negative load factor"); + testSucceeded = false; + try { + // this should generate an IllegalArgumentException + WeakHashMap bad1 = new WeakHashMap(100, -3); + } + catch (IllegalArgumentException e1) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("WeakHashMap, negative load factor"); - testSucceeded = false; - try { - // this should generate an IllegalArgumentException - WeakHashMap bad1 = new WeakHashMap(100, Float.NaN); - } - catch (IllegalArgumentException e1) { - testSucceeded = true; - } - if (!testSucceeded) - throw new Exception("WeakHashMap, NaN load factor"); + testSucceeded = false; + try { + // this should generate an IllegalArgumentException + WeakHashMap bad1 = new WeakHashMap(100, Float.NaN); + } + catch (IllegalArgumentException e1) { + testSucceeded = true; + } + if (!testSucceeded) + throw new Exception("WeakHashMap, NaN load factor"); - // Make sure that legal creates don't throw exceptions - Map goodMap = new Hashtable(100, .69f); - goodMap = new HashMap(100, .69f); - Set goodSet = new HashSet(100, .69f); - goodMap = new WeakHashMap(100, .69f); - } - + // Make sure that legal creates don't throw exceptions + Map goodMap = new Hashtable(100, .69f); + goodMap = new HashMap(100, .69f); + Set goodSet = new HashSet(100, .69f); + goodMap = new WeakHashMap(100, .69f); + } }
--- a/test/jdk/java/util/Hashtable/SelfRef.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Hashtable/SelfRef.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4421469 6282555 * @summary Hashtable's toString method should detect self-referential
--- a/test/jdk/java/util/LinkedHashMap/Basic.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/LinkedHashMap/Basic.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4245809 8029795 * @summary Basic test for LinkedHashMap. (Based on MapBash)
--- a/test/jdk/java/util/LinkedHashMap/Cache.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/LinkedHashMap/Cache.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4245809 * @summary Basic test of removeEldestElement method.
--- a/test/jdk/java/util/LinkedHashMap/EmptyMapIterator.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/LinkedHashMap/EmptyMapIterator.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4473440 * @summary iterators on collection views of empty map weren't fail-fast. @@ -30,7 +30,7 @@ import java.util.*; public class EmptyMapIterator { - public static void main(String args[]) throws Exception { + public static void main(String[] args) throws Exception { HashMap map = new HashMap(); Iterator iter = iter = map.entrySet().iterator(); map.put("key", "value");
--- a/test/jdk/java/util/LinkedHashSet/Basic.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/LinkedHashSet/Basic.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4245809 * @summary Basic test for LinkedHashSet. (Based on SetBash) @@ -133,9 +133,8 @@ } static void AddRandoms(Set s, int n) throws Exception { - for (int i=0; i<n; i++) { - int r = rnd.nextInt() % n; - Integer e = new Integer(r < 0 ? -r : r); + for (int i = 0; i < n; i++) { + Integer e = rnd.nextInt(n); int preSize = s.size(); boolean prePresent = s.contains(e);
--- a/test/jdk/java/util/LinkedList/AddAll.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/LinkedList/AddAll.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4163207 * @summary AddAll was prepending instead of appending!
--- a/test/jdk/java/util/NavigableMap/LockStep.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/NavigableMap/LockStep.java Thu Nov 09 16:14:45 2017 -0800 @@ -848,11 +848,11 @@ } interface Fun {void f() throws Throwable;} static void THROWS(Class<? extends Throwable> k, Fun... fs) { - for (Fun f : fs) - try { f.f(); fail("Expected " + k.getName() + " not thrown"); } - catch (Throwable t) { - if (k.isAssignableFrom(t.getClass())) pass(); - else unexpected(t);}} + for (Fun f : fs) + try { f.f(); fail("Expected " + k.getName() + " not thrown"); } + catch (Throwable t) { + if (k.isAssignableFrom(t.getClass())) pass(); + else unexpected(t);}} static byte[] serializedForm(Object obj) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream();
--- a/test/jdk/java/util/Random/NextIntPowerOfTwoMod.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Random/NextIntPowerOfTwoMod.java Thu Nov 09 16:14:45 2017 -0800 @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4187412 * @summary The FCS release of 1.2 did not special case the Random.nextInt
--- a/test/jdk/java/util/TreeMap/HeadTailTypeError.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/TreeMap/HeadTailTypeError.java Thu Nov 09 16:14:45 2017 -0800 @@ -31,7 +31,7 @@ import java.util.*; public class HeadTailTypeError { - public static void main(String argv[]) throws Exception { + public static void main(String[] args) throws Exception { try { SortedMap m = new TreeMap(); m.headMap(new Object());
--- a/test/jdk/java/util/TreeMap/SubMap.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/TreeMap/SubMap.java Thu Nov 09 16:14:45 2017 -0800 @@ -30,7 +30,7 @@ import java.util.*; public class SubMap { - public static void main(String args[]) throws Exception { + public static void main(String[] args) throws Exception { SortedMap m = new TreeMap(); m.put(new Integer(1), new Integer(1)); m.put(new Integer(2), new Integer(2));
--- a/test/jdk/java/util/TreeMap/SubMapClear.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/TreeMap/SubMapClear.java Thu Nov 09 16:14:45 2017 -0800 @@ -39,7 +39,7 @@ Set subSet = treeSet.subSet(new Integer(4),new Integer(10)); subSet.clear(); // Used to throw exception - int a[] = new int[] {1, 2, 3, 10}; + int[] a = { 1, 2, 3, 10 }; Set s = new TreeSet(); for (int i = 0; i < a.length; i++) s.add(new Integer(a[i]));
--- a/test/jdk/java/util/Vector/IllegalConstructorArgs.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Vector/IllegalConstructorArgs.java Thu Nov 09 16:14:45 2017 -0800 @@ -36,12 +36,12 @@ */ public class IllegalConstructorArgs { - public static void main(String argv[]) { - int testSucceeded=0; + public static void main(String[] args) { + int testSucceeded=0; try { - // this should generate an IllegalArgumentException - Vector bad1 = new Vector(-100, 10); + // this should generate an IllegalArgumentException + Vector bad1 = new Vector(-100, 10); } catch (IllegalArgumentException e1) { testSucceeded =1;
--- a/test/jdk/java/util/Vector/LastIndexOf.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Vector/LastIndexOf.java Thu Nov 09 16:14:45 2017 -0800 @@ -31,7 +31,7 @@ import java.util.*; public class LastIndexOf { - public static void main(String argv[]) throws Exception { + public static void main(String[] args) throws Exception { Vector v = new Vector(10); try {
--- a/test/jdk/java/util/Vector/SyncLastIndexOf.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/Vector/SyncLastIndexOf.java Thu Nov 09 16:14:45 2017 -0800 @@ -46,7 +46,7 @@ } } - public static void main(String args[]) { + public static void main(String[] args) { Integer x = new Integer(1); v.addElement(x); new RemovingThread().start();
--- a/test/jdk/java/util/WeakHashMap/ZeroInitCap.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/WeakHashMap/ZeroInitCap.java Thu Nov 09 16:14:45 2017 -0800 @@ -23,7 +23,7 @@ import java.util.*; -/** +/* * @test * @bug 4503146 * @summary Zero initial capacity should be legal @@ -31,7 +31,7 @@ */ public class ZeroInitCap { - public static void main(String[] argv) { + public static void main(String[] args) { Map map = new WeakHashMap(0); map.put("a","b"); }
--- a/test/jdk/java/util/concurrent/ConcurrentHashMap/ToArray.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/ToArray.java Thu Nov 09 16:14:45 2017 -0800 @@ -43,7 +43,7 @@ } static void executeTest() throws Throwable { - final Throwable throwable[] = new Throwable[1]; + final Throwable[] throwable = new Throwable[1]; final ConcurrentHashMap<Integer, Integer> m = new ConcurrentHashMap<>(); // Number of workers equal to the number of processors
--- a/test/jdk/java/util/concurrent/CountDownLatch/Basic.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/concurrent/CountDownLatch/Basic.java Thu Nov 09 16:14:45 2017 -0800 @@ -96,7 +96,7 @@ int count = 0; Basic test = new Basic(); CountDownLatch latch = new CountDownLatch(3); - Awaiter a[] = new Awaiter[12]; + Awaiter[] a = new Awaiter[12]; for (int i = 0; i < 3; i++) { CountDownLatch gate = new CountDownLatch(4); @@ -125,7 +125,7 @@ int count = 0; Basic test = new Basic(); CountDownLatch latch = new CountDownLatch(3); - Awaiter a[] = new Awaiter[12]; + Awaiter[] a = new Awaiter[12]; for (int i = 0; i < 3; i++) { CountDownLatch gate = new CountDownLatch(4); @@ -156,7 +156,7 @@ int count =0; Basic test = new Basic(); CountDownLatch latch = new CountDownLatch(3); - Awaiter a[] = new Awaiter[12]; + Awaiter[] a = new Awaiter[12]; long[] timeout = { 0L, 5L, 10L };
--- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java Thu Nov 09 16:14:45 2017 -0800 @@ -57,12 +57,14 @@ }}); test(OutOfMemoryError.class, new ThreadFactory() { - public Thread newThread(Runnable r) { - new Thread(null, r, "a natural OOME", 1L << 60); - // """On some platforms, the value of the stackSize - // parameter may have no effect whatsoever.""" - throw new OutOfMemoryError("artificial OOME"); - }}); + @SuppressWarnings("DeadThread") + public Thread newThread(Runnable r) { + // We expect this to throw OOME, but ... + new Thread(null, r, "a natural OOME", 1L << 60); + // """On some platforms, the value of the stackSize + // parameter may have no effect whatsoever.""" + throw new OutOfMemoryError("artificial OOME"); + }}); test(null, new ThreadFactory() { public Thread newThread(Runnable r) {
--- a/test/jdk/java/util/concurrent/locks/Lock/FlakyMutex.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/concurrent/locks/Lock/FlakyMutex.java Thu Nov 09 16:14:45 2017 -0800 @@ -108,6 +108,7 @@ case 0: throw new MyError(); case 1: throw new MyRuntimeException(); case 2: FlakyMutex.<RuntimeException>uncheckedThrow(new MyException()); + // fall through ... NOT! default: return compareAndSetState(0, 1); } }
--- a/test/jdk/java/util/concurrent/tck/NonNestmates.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/concurrent/tck/NonNestmates.java Thu Nov 09 16:14:45 2017 -0800 @@ -35,7 +35,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue;
--- a/test/jdk/java/util/concurrent/tck/SubmissionPublisherTest.java Thu Nov 09 16:10:46 2017 -0800 +++ b/test/jdk/java/util/concurrent/tck/SubmissionPublisherTest.java Thu Nov 09 16:14:45 2017 -0800 @@ -593,7 +593,7 @@ /** * estimateMinimumDemand reports 0 until request, nonzero after - * request, and zero again after delivery + * request */ public void testEstimateMinimumDemand() { TestSubscriber s = new TestSubscriber(); @@ -604,9 +604,6 @@ assertEquals(0, p.estimateMinimumDemand()); s.sn.request(1); assertEquals(1, p.estimateMinimumDemand()); - p.submit(1); - s.awaitNext(1); - assertEquals(0, p.estimateMinimumDemand()); } /**