changeset 54398:446ec34c7838

8219480: j.l.c.ClassDesc::arrayType(int rank) throws IllegalArgumentException if rank = 0 Reviewed-by: mchung, briangoetz
author vromero
date Sat, 23 Feb 2019 19:41:53 -0500
parents 45a23c64d0f6
children 072b382347db
files src/java.base/share/classes/java/lang/constant/ClassDesc.java test/jdk/java/lang/constant/ClassDescTest.java
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 {