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

specification of j.l.c.MethodTypeDesc::of should document better the exceptions thrown

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 13
    • core-libs
    • None
    • behavioral
    • minimal
    • Java API
    • SE

      Summary

      The specification for method java.lang.constant.MethodTypeDesc::of doesn't document all the exceptions it throws, the specification must be updated in order to solve this issue

      Problem

      The specification for method java.lang.constant.MethodTypeDesc::of doesn't document all the exceptions it throws. Also the documentation for the case of exception NullPointerException should cover the hypothetical case in which the content of parameter paramDescs contains a null reference.

      Solution

      Update the specification of method java.lang.constant.MethodTypeDesc::of for it to correctly document the exceptions thrown in all cases.

      Specification

      diff -r b6ee58ec8814 -r 677a8eeb0773 src/java.base/share/classes/java/lang/constant/MethodTypeDesc.java
      --- a/src/java.base/share/classes/java/lang/constant/MethodTypeDesc.java        Thu May 16 13:34:33 2019 -0400
      +++ b/src/java.base/share/classes/java/lang/constant/MethodTypeDesc.java        Fri May 17 12:36:56 2019 -0400
      @@ -65,7 +65,9 @@
            * @param returnDesc a {@linkplain ClassDesc} describing the return type
            * @param paramDescs {@linkplain ClassDesc}s describing the argument types
            * @return a {@linkplain MethodTypeDesc} describing the desired method type
      -     * @throws NullPointerException if any argument is {@code null}
      +     * @throws NullPointerException if any argument or its contents are {@code null}
      +     * @throws IllegalArgumentException if any element of {@code paramDescs} is a
      +     * {@link ClassDesc} for {@code void}
            */
           static MethodTypeDesc of(ClassDesc returnDesc, ClassDesc... paramDescs) {
               return new MethodTypeDescImpl(returnDesc, paramDescs);

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

              Created:
              Updated:
              Resolved: