8219480: j.l.c.ClassDesc::arrayType(int rank) throws IllegalArgumentException if rank = 0
authorvromero
Sat, 23 Feb 2019 19:41:53 -0500
changeset 53909 446ec34c7838
parent 53908 45a23c64d0f6
child 53910 072b382347db
8219480: j.l.c.ClassDesc::arrayType(int rank) throws IllegalArgumentException if rank = 0 Reviewed-by: mchung, briangoetz
src/java.base/share/classes/java/lang/constant/ClassDesc.java
test/jdk/java/lang/constant/ClassDescTest.java
--- a/src/java.base/share/classes/java/lang/constant/ClassDesc.java	Sat Feb 23 10:55:45 2019 +0100
+++ b/src/java.base/share/classes/java/lang/constant/ClassDesc.java	Sat Feb 23 19:41:53 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
      */
--- a/test/jdk/java/lang/constant/ClassDescTest.java	Sat Feb 23 10:55:45 2019 +0100
+++ b/test/jdk/java/lang/constant/ClassDescTest.java	Sat Feb 23 19:41:53 2019 -0500
@@ -176,6 +176,12 @@
         } catch (IllegalArgumentException e) {
             // good
         }
+        try {
+            cr.arrayType(0);
+            fail("");
+        } catch (IllegalArgumentException e) {
+            // good
+        }
     }
 
     public void testArrayClassDesc() throws ReflectiveOperationException {