< prev index next >

test/jdk/java/util/Collections/CheckedListBash.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2003, 2024, 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
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -21,11 +21,11 @@
   * questions.
   */
  
  /*
   * @test
-  * @bug     4904067
+  * @bug     4904067 8336669
   * @summary Unit test for Collections.checkedList
   * @author  Josh Bloch
   * @key randomness
   */
  

@@ -107,11 +107,11 @@
                  fail("set(int, Object) doesn't work");
          }
  
          List s = newList();
          for (int i=0; i<listSize; i++)
-             s.add(new Integer(i));
+             s.add(i);
          if (s.size() != listSize)
              fail("Size of [0..n-1] != n");
  
          List even = clone(s);
          Iterator it = even.iterator();

@@ -145,17 +145,12 @@
              itAll.previous(); // ???
          }
          itAll = all.listIterator();
          while (itAll.hasNext()) {
              Integer i = (Integer)itAll.next();
-             itAll.set(new Integer(i.intValue()));
+             itAll.set(i);
          }
-         itAll = all.listIterator();
-         it = s.iterator();
-         while (it.hasNext())
-             if (it.next()==itAll.next())
-                 fail("Iterator.set failed to change value.");
          if (!all.equals(s))
              fail("Failed to reconstruct ints with ListIterator.");
  
          it = all.listIterator();
          int i=0;

@@ -179,11 +174,11 @@
          ia = new Integer[listSize];
          Integer[] ib = (Integer[]) l.toArray(ia);
          if (ia != ib || !l.equals(Arrays.asList(ia)))
              fail("toArray(Object[]) is hosed (2)");
          ia = new Integer[listSize+1];
-         ia[listSize] = new Integer(69);
+         ia[listSize] = 69;
          ib = (Integer[]) l.toArray(ia);
          if (ia != ib || ia[listSize] != null
              || !l.equals(Arrays.asList(ia).subList(0, listSize)))
              fail("toArray(Object[]) is hosed (3)");
  
< prev index next >