mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8235369: Class.toGenericString need to be updated for records
Reviewed-by: vromero, mchung, chegar
This commit is contained in:
parent
df308ac680
commit
81ec9e3087
2 changed files with 11 additions and 4 deletions
|
@ -207,8 +207,8 @@ public final class Class<T> implements java.io.Serializable,
|
|||
*
|
||||
* The string is formatted as a list of type modifiers, if any,
|
||||
* followed by the kind of type (empty string for primitive types
|
||||
* and {@code class}, {@code enum}, {@code interface}, or
|
||||
* <code>@</code>{@code interface}, as appropriate), followed
|
||||
* and {@code class}, {@code enum}, {@code interface},
|
||||
* <code>@</code>{@code interface}, or {@code record} as appropriate), followed
|
||||
* by the type's name, followed by an angle-bracketed
|
||||
* comma-separated list of the type's type parameters, if any,
|
||||
* including informative bounds on the type parameters, if any.
|
||||
|
@ -234,6 +234,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
@SuppressWarnings("preview")
|
||||
public String toGenericString() {
|
||||
if (isPrimitive()) {
|
||||
return toString();
|
||||
|
@ -264,6 +265,8 @@ public final class Class<T> implements java.io.Serializable,
|
|||
} else {
|
||||
if (isEnum())
|
||||
sb.append("enum");
|
||||
else if (isRecord())
|
||||
sb.append("record");
|
||||
else
|
||||
sb.append("class");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue