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

j.l.c.MethodTypeDesc::ofConstructor spec should contain precise assertions for its parameters

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 13
    • core-libs
    • None
    • behavioral
    • minimal
    • the NPE exception was already being thrown, but it wasn't properly documented in the spec
    • Java API
    • SE

      Summary

      Method java.lang.constant.MethodTypeDesc::ofConstructor should have precise assertions for the cases for which a NullPointerException can be thrown

      Problem

      Method java.lang.constant.MethodTypeDesc::ofConstructor doesn't have precise assertions for the cases for which a NullPointerException can be thrown.

      Solution

      Update the specification to indicate in a precise way when a NPE can be thrown

      Specification

      diff -r b99e97bc5040 -r 95a9343e7881 src/java.base/share/classes/java/lang/constant/MethodHandleDesc.java
      --- a/src/java.base/share/classes/java/lang/constant/MethodHandleDesc.java      Wed May 15 08:58:23 2019 -0400
      +++ b/src/java.base/share/classes/java/lang/constant/MethodHandleDesc.java      Thu May 16 12:50:11 2019 -0400
      @@ -177,7 +177,7 @@
            * @param paramTypes {@link ClassDesc}s describing the parameter types of
            *                   the constructor
            * @return the {@linkplain MethodHandleDesc}
      -     * @throws NullPointerException if any of the arguments are null
      +     * @throws NullPointerException if any argument or its contents is {@code null}
            */
           static DirectMethodHandleDesc ofConstructor(ClassDesc owner,
                                                       ClassDesc... paramTypes) {

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

              Created:
              Updated:
              Resolved: