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

j.l.c.ClassDesc::nested(String, String...) must throw NPE if any arg is null

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 13
    • core-libs
    • None
    • behavioral
    • minimal
    • The java.lang.constant API is very recent, introduced in JDK12, so we don't expect that there is a lot of user code depending on it
    • Java API
    • SE

      Summary

      The API for method: j.l.c.ClassDesc::nested(String, String...) states that it will throw an exception if any argument is null and the implementation must enforce this assertion

      Problem

      The API for method: j.l.c.ClassDesc::nested(String, String...) states that it will throw an exception if any argument is null. The implementation is not enforcing this assertion

      Solution

      Throw a NullPointerException if any argument passed to the method is null.

      Specification

            /**
             * Returns a {@linkplain ClassDesc} for a nested class of the class or
             * interface type described by this {@linkplain ClassDesc}.
             *
             * @param firstNestedName the unqualified name of the first level of nested class
             * @param moreNestedNames the unqualified name(s) of the remaining levels of
             *                       nested class
             * @return a {@linkplain ClassDesc} describing the nested class
       -     * @throws NullPointerException if any argument is {@code null}
       +     * @throws NullPointerException if any argument or its contents is {@code null}
             * @throws IllegalStateException if this {@linkplain ClassDesc} does not
             * describe a class or interface type
             * @throws IllegalArgumentException if the nested class name is invalid
             */

            vromero Vicente Arturo Romero Zaldivar
            lkuskov Leonid Kuskov
            Joe Darcy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: