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

Method Comparator.thenComparing((Comparator)null) doesn't throw specified NPE

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P2
    • Resolution: Fixed
    • 8
    • 8
    • core-libs

    Description

      Method of class Comparator

          default <S extends T> Comparator<S> thenComparing(Comparator<? super T> other)

      Specifies

      Throws:
          NullPointerException - if the argument is null.


      This assertion is not satisfied by build 81-lambda.

      The following

              ((Comparator<?>)(a, b) -> 0).thenComparing((Comparator)null);

      will not throw anything.

      The following JCK test will fail due to this issue:
      api/java_util/Comparator/DefenderMethods.html#DefenderMethods[thenComparingWithNull]

      Attachments

        Activity

          People

            henryjen Henry Jen
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: