-
CSR
-
Resolution: Approved
-
P4
-
behavioral
-
minimal
-
Java API
-
SE
Summary
Update Class.toString
and Class.toGenericString
to explicitly describe the handling of array types.
Problem
The Class.toGenericString and Class.toString methods do not mention how they handle array types.
Solution
Add specifications for those cases.
Specification
Changes to toString:
--- old/src/java.base/share/classes/java/lang/Class.java 2015-01-14 17:01:16.836552449 -0800
+++ new/src/java.base/share/classes/java/lang/Class.java 2015-01-14 17:01:16.676552456 -0800
@@ -149,7 +149,8 @@
* {@code getName}. If this {@code Class} object represents a
* primitive type, this method returns the name of the primitive type. If
* this {@code Class} object represents void this method returns
- * "void".
+ * "void". If this {@code Class} object represents an array type,
+ * this method returns "class " followed by {@code getName}.
*
* @return a string representation of this class object.
*/
Changes to toGenericString:
@@ -174,6 +175,12 @@
* occur in canonical order. If there are no type parameters, the
* type parameter list is elided.
*
+ * For an array type, the string starts with the type name,
+ * followed by an angle-bracketed comma-separated list of the
+ * type's type parameters, if any, followed by a sequence of
+ * {@code []} characters, one set of brackets per dimension of
+ * the array.
+ *
* <p>Note that since information about the runtime representation
* of a type is being generated, modifiers not present on the
* originating source code or illegal on the originating source
- csr for
-
JDK-8060077 Class.toGenericString specification doesn't mention array types
-
- Resolved
-