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

j.l.c.ClassDesc::arrayType(int rank) throws IllegalArgumentException if rank = 0

XMLWordPrintable

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

      Summary

      The API for method java.lang.constant.ClassDesc::arrayType(int) is not in sync with its implementation. The spec should be modified to match the method's implementation.

      Problem

      The API for method java.lang.constant.ClassDesc::arrayType(int) is not in sync with its implementation

      Solution

      Update the spec of java.lang.constant.ClassDesc::arrayType(int) to throw IAE if rank <= 0

      Specification

      diff -r 748932cafa41 -r d617bc0baefa src/java.base/share/classes/java/lang/constant/ClassDesc.java
      --- a/src/java.base/share/classes/java/lang/constant/ClassDesc.java     Wed Feb 20 16:20:53 2019 -0500
      +++ b/src/java.base/share/classes/java/lang/constant/ClassDesc.java     Wed Feb 20 17:59:47 2019 -0500
      @@ -170,7 +170,7 @@
            *
            * @param rank the rank of the array
            * @return a {@linkplain ClassDesc} describing the array type
      -     * @throws IllegalArgumentException if the rank is less than zero or if the rank of the resulting array type is
      +     * @throws IllegalArgumentException if the rank is less than or equal to zero or if the rank of the resulting array type is
            * greater than 255
            * @jvms 4.4.1 The CONSTANT_Class_info Structure
            */

            vromero Vicente Arturo Romero Zaldivar
            lkuskov Leonid Kuskov
            Mandy Chung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: