< prev index next >
src/java.base/share/classes/java/lang/Class.java
Print this page
*** 205,216 ****
* Returns a string describing this {@code Class}, including
* information about modifiers and type parameters.
*
* 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
* 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.
*
* A space is used to separate modifiers from one another and to
--- 205,216 ----
* Returns a string describing this {@code Class}, including
* information about modifiers and type parameters.
*
* 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},
! * <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.
*
* A space is used to separate modifiers from one another and to
*** 232,241 ****
--- 232,242 ----
* @return a string describing this {@code Class}, including
* information about modifiers and type parameters
*
* @since 1.8
*/
+ @SuppressWarnings("preview")
public String toGenericString() {
if (isPrimitive()) {
return toString();
} else {
StringBuilder sb = new StringBuilder();
*** 262,271 ****
--- 263,274 ----
if (isInterface()) { // Note: all annotation types are interfaces
sb.append("interface");
} else {
if (isEnum())
sb.append("enum");
+ else if (isRecord())
+ sb.append("record");
else
sb.append("class");
}
sb.append(' ');
sb.append(getName());
< prev index next >