< prev index next >

test/jdk/java/util/Spliterator/SpliteratorLateBindingTest.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2013, 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.

@@ -50,11 +50,11 @@
  
  import static org.testng.Assert.assertEquals;
  
  /**
   * @test
-  * @bug 8148748 8170155
+  * @bug 8148748 8170155 8336672
   * @summary Spliterator last-binding tests
   * @run testng SpliteratorLateBindingTest
   */
  
  @Test

@@ -67,12 +67,12 @@
          if (spliteratorDataProvider != null) {
              return spliteratorDataProvider;
          }
  
          List<Object[]> data = new ArrayList<>();
-         SpliteratorDataBuilder<Integer> db =
-                 new SpliteratorDataBuilder<>(data, 5, Arrays.asList(1, 2, 3, 4));
+         SpliteratorDataBuilder<String> db =
+                 new SpliteratorDataBuilder<>(data, "Z", Arrays.asList("A", "B", "C", "D"));
  
          // Collections
  
          db.addList(ArrayList::new);
  

@@ -87,11 +87,11 @@
          db.addCollection(LinkedHashSet::new);
  
          db.addCollection(TreeSet::new);
  
          db.addCollection(c -> {
-             Stack<Integer> s = new Stack<>();
+             Stack<String> s = new Stack<>();
              s.addAll(c);
              return s;
          });
  
          db.addCollection(PriorityQueue::new);

@@ -104,17 +104,19 @@
  
          db.addMap(LinkedHashMap::new);
  
          db.addMap(IdentityHashMap::new);
  
+         // BUG: Assumes identity
          db.addMap(WeakHashMap::new);
  
          // @@@  Descending maps etc
          db.addMap(TreeMap::new);
  
          // BitSet
  
+         // BUG: Assumes identity in WeakHashMap
          List<Integer> bits = List.of(0, 1, 2);
          Function<BitSet, Spliterator.OfInt> bitsSource = bs -> bs.stream().spliterator();
          db.add("new BitSet.stream().spliterator() ADD",
                 () -> new IntSource<>(toBitSet(bits), bitsSource, bs -> bs.set(3)));
          db.add("new BitSet.stream().spliterator() REMOVE",
< prev index next >