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

"".codePoints().sorted().iterator().hasNext() causes NegativeArraySizeException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2
    • 8
    • 8
    • core-libs
    • JDK8 b107 Windows7x64

    • 8
    • b110
    • x86
    • windows_7
    • Verified

    Description

      Following code

      public class Test {
          public static void main(String[] args) {
              "".codePoints().sorted().iterator().hasNext();
          }
      }

      causes following output:
      Exception in thread "main" java.lang.NegativeArraySizeException
      at java.util.stream.SortedOps$SizedIntSortingSink.begin(SortedOps.java:367)
      at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:159)
      at java.util.stream.StreamSpliterators$IntWrappingSpliterator.tryAdvance(StreamSpliterators.java:357)
      at java.util.Spliterators$2Adapter.hasNext(Spliterators.java:726)
      at Test.main(Test.java:3)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:491)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

      The minimized test is attached

      Attachments

        1. Test.java
          0.1 kB
          Georgiy Rakov

        Activity

          People

            psandoz Paul Sandoz
            grakov Georgiy Rakov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: