Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8017329

8b92-lambda regression: TreeSet("a", "b").stream().substream(1).parallel().iterator() is empty

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P2
    • Resolution: Fixed
    • None
    • 8
    • core-libs

    Description

      Since approximately JDK8-lambda build 92 the following regression is being observed:
      the following code:

              Stream stream = new TreeSet(Arrays.asList("a", "b")).stream();
              Stream substream = stream.substream(1);
              Stream parallel = (Stream) substream.parallel();
              java.util.Iterator iterator = parallel.iterator();
              System.out.println("iterator.hasNext() = " + iterator.hasNext());
              System.out.println("iterator.next() = " + iterator.next());


      will produce output like:

      ----------------------------------------
      iterator.hasNext() = false
      Exception in thread "main" java.util.NoSuchElementException
      ----------------------------------------

      The code works as expected with JDK8b95 main JDK8 binaries producing iterator over a single element "b".

      Plenty of JCK tests started to fail due to this regression:

      api/java_util/concurrent/ConcurrentSkipListSet/Stream.html#Stream[checkSubstream]
      api/java_util/concurrent/ConcurrentSkipListSet/Stream.html#Stream[checkSubstream2]
      api/java_util/concurrent/ConcurrentSkipListSet/ParallelStream.html#ParallelStream[checkSubstream]
      api/java_util/concurrent/ConcurrentSkipListSet/ParallelStream.html#ParallelStream[checkSubstream2]
      api/java_util/TreeSet/Stream.html#Stream[checkSubstream]
      api/java_util/TreeSet/Stream.html#Stream[checkSubstream2]
      api/java_util/TreeSet/ParallelStream.html#ParallelStream[checkSubstream]
      api/java_util/TreeSet/ParallelStream.html#ParallelStream[checkSubstream2]
      api/java_util/TreeMap/KeySetParallelStream.html#KeySetParallelStream[checkSubstream]
      api/java_util/TreeMap/KeySetParallelStream.html#KeySetParallelStream[checkSubstream2]
      api/java_util/TreeMap/KeySetStream.html#KeySetStream[checkSubstream]
      api/java_util/TreeMap/KeySetStream.html#KeySetStream[checkSubstream2]
      api/java_util/TreeMap/EntrySetParallelStream.html#KeySetParallelStream[checkSubstream]
      api/java_util/TreeMap/EntrySetParallelStream.html#KeySetParallelStream[checkSubstream2]
      api/java_util/TreeMap/EntrySetStream.html#KeySetStream[checkSubstream]
      api/java_util/TreeMap/EntrySetStream.html#KeySetStream[checkSubstream2]
      api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedSetStream[checkSubstream]
      api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedSetStream[checkSubstream2]
      api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedSetParallelStream[checkSubstream]
      api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedSetParallelStream[checkSubstream2]
      api/java_util/TreeMap/EntrySetParallelStream.html#EntrySetParallelStream[checkSubstream]
      api/java_util/TreeMap/EntrySetParallelStream.html#EntrySetParallelStream[checkSubstream2]
      api/java_util/TreeMap/EntrySetStream.html#EntrySetStream[checkSubstream]
      api/java_util/TreeMap/EntrySetStream.html#EntrySetStream[checkSubstream2]
      api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapKeySetStream[checkSubstream]             
      api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapKeySetStream[checkSubstream2]            
      api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapKeySetParallelStream[checkSubstream]     
      api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapKeySetParallelStream[checkSubstream2]    
      api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapValueParallelStream[checkSubstream]      
      api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapValueParallelStream[checkSubstream2]     
      api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapValueStream[checkSubstream]
      api/java_util/Collections/unmodifiable/index.html#UnmodifiableSortedMapValueStream[checkSubstream2]
      api/java_util/Collections/synchronizd/index.html#SynchronizedSortedMapValueStream[checkSubstream]
      api/java_util/Collections/synchronizd/index.html#SynchronizedSortedMapValueStream[checkSubstream2]
      api/java_util/Collections/synchronizd/index.html#SynchronizedSortedMapValueParallelStream[checkSubstream]
      api/java_util/Collections/synchronizd/index.html#SynchronizedSortedMapValueParallelStream[checkSubstream2]

      Attachments

        Issue Links

          Activity

            People

              psandoz Paul Sandoz
              dbessono Dmitry Bessonov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: