< prev index next >

test/jdk/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java

Print this page
@@ -23,16 +23,20 @@
  
  /**
   * @test
   * @summary Spliterator traversing and splitting tests
   * @library /lib/testlibrary/bootlib
+  * @modules java.base/jdk.internal.misc
   * @build java.base/java.util.SpliteratorOfIntDataBuilder
   *        java.base/java.util.SpliteratorTestHelper
   * @run testng SpliteratorTraversingAndSplittingTest
-  * @bug 8020016 8071477 8072784 8169838
+  * @run testng/othervm --enable-preview SpliteratorTraversingAndSplittingTest
+  * @bug 8020016 8071477 8072784 8169838 8336672
   */
  
+ import jdk.internal.misc.PreviewFeatures;
+ 
  import org.testng.annotations.DataProvider;
  import org.testng.annotations.Test;
  
  import java.nio.CharBuffer;
  import java.util.AbstractCollection;

@@ -644,20 +648,23 @@
  
              db.addMap(LinkedHashMap::new);
  
              db.addMap(IdentityHashMap::new);
  
-             db.addMap(WeakHashMap::new);
- 
-             db.addMap(m -> {
-                 // Create a Map ensuring that for large sizes
-                 // buckets will be consist of 2 or more entries
-                 WeakHashMap<Integer, Integer> cm = new WeakHashMap<>(1, m.size() + 1);
-                 for (Map.Entry<Integer, Integer> e : m.entrySet())
-                     cm.put(e.getKey(), e.getValue());
-                 return cm;
-             }, "new java.util.WeakHashMap(1, size + 1)");
+             if (!PreviewFeatures.isEnabled()) {
+                 // With --enable-preview, WeakHashmap is not tested with Integer, a value class
+                 db.addMap(WeakHashMap::new);
+ 
+                 db.addMap(m -> {
+                     // Create a Map ensuring that for large sizes
+                     // buckets will consist of 2 or more entries
+                     WeakHashMap<Integer, Integer> cm = new WeakHashMap<>(1, m.size() + 1);
+                     for (Map.Entry<Integer, Integer> e : m.entrySet())
+                         cm.put(e.getKey(), e.getValue());
+                     return cm;
+                 }, "new java.util.WeakHashMap(1, size + 1)");
+             }
  
              db.addMap(TreeMap::new);
              db.addMap(m -> new TreeMap<>(m).tailMap(Integer.MIN_VALUE));
              db.addMap(m -> new TreeMap<>(m).headMap(Integer.MAX_VALUE));
              db.addMap(m -> new TreeMap<>(m).subMap(Integer.MIN_VALUE, Integer.MAX_VALUE));
< prev index next >