8310267: Javadoc for Class#isPrimitive() is incorrect regarding Class objects for primitives

Reviewed-by: prappo
This commit is contained in:
Joe Darcy 2023-06-23 19:35:57 +00:00
parent a9c0a0f6b9
commit 0314292cb2

View File

@ -807,19 +807,28 @@ public final class Class<T> implements java.io.Serializable,
/** /**
* Determines if the specified {@code Class} object represents a * Determines if this {@code Class} object represents a primitive
* primitive type. * type or void.
* *
* <p> There are nine predefined {@code Class} objects to represent * <p> There are nine predefined {@code Class} objects to
* the eight primitive types and void. These are created by the Java * represent the eight primitive types and void. These are
* Virtual Machine, and have the same names as the primitive types that * created by the Java Virtual Machine, and have the same
* they represent, namely {@code boolean}, {@code byte}, * {@linkplain #getName() names} as the primitive types that they
* {@code char}, {@code short}, {@code int}, * represent, namely {@code boolean}, {@code byte}, {@code char},
* {@code long}, {@code float}, and {@code double}. * {@code short}, {@code int}, {@code long}, {@code float}, and
* {@code double}.
* *
* <p> These objects may only be accessed via the following public static * <p>No other class objects are considered primitive.
* final variables, and are the only {@code Class} objects for which *
* this method returns {@code true}. * @apiNote
* A {@code Class} object represented by a primitive type can be
* accessed via the {@code TYPE} public static final variables
* defined in the primitive wrapper classes such as {@link
* java.lang.Integer#TYPE Integer.TYPE}. In the Java programming
* language, the objects may be referred to by a class literal
* expression such as {@code int.class}. The {@code Class} object
* for void can be expressed as {@code void.class} or {@link
* java.lang.Void#TYPE Void.TYPE}.
* *
* @return true if and only if this class represents a primitive type * @return true if and only if this class represents a primitive type
* *
@ -833,6 +842,7 @@ public final class Class<T> implements java.io.Serializable,
* @see java.lang.Double#TYPE * @see java.lang.Double#TYPE
* @see java.lang.Void#TYPE * @see java.lang.Void#TYPE
* @since 1.1 * @since 1.1
* @jls 15.8.2 Class Literals
*/ */
@IntrinsicCandidate @IntrinsicCandidate
public native boolean isPrimitive(); public native boolean isPrimitive();