diff --git a/src/java.base/share/classes/java/lang/Class.java b/src/java.base/share/classes/java/lang/Class.java index 7eb5256e5e8f4..c30942aa3eeaa 100644 --- a/src/java.base/share/classes/java/lang/Class.java +++ b/src/java.base/share/classes/java/lang/Class.java @@ -2080,6 +2080,7 @@ public Method[] getMethods() throws SecurityException { * s.checkPackageAccess()} denies access to the package * of this class. * + * @see #getDeclaredConstructors() * @since 1.1 */ @CallerSensitive @@ -2279,7 +2280,9 @@ public Method getMethod(String name, Class>... parameterTypes) * @param parameterTypes the parameter array * @return the {@code Constructor} object of the public constructor that * matches the specified {@code parameterTypes} - * @throws NoSuchMethodException if a matching method is not found. + * @throws NoSuchMethodException if a matching constructor is not found, + * including when this {@code Class} object represents + * an interface, a primitive type, an array class, or void. * @throws SecurityException * If a security manager, s, is present and * the caller's class loader is not the same as or an @@ -2288,6 +2291,7 @@ public Method getMethod(String name, Class>... parameterTypes) * s.checkPackageAccess()} denies access to the package * of this class. * + * @see #getDeclaredConstructor(Class>[]) * @since 1.1 */ @CallerSensitive @@ -2536,21 +2540,20 @@ public Method[] getDeclaredMethods() throws SecurityException { return copyMethods(privateGetDeclaredMethods(false)); } - /** * Returns an array of {@code Constructor} objects reflecting all the - * constructors declared by the class represented by this + * constructors implicitly or explicitly declared by the class represented by this * {@code Class} object. These are public, protected, default * (package) access, and private constructors. The elements in the array * returned are not sorted and are not in any particular order. If the - * class has a default constructor, it is included in the returned array. + * class has a default constructor (JLS {@jls 8.8.9}), it is included in the returned array. + * If a record class has a canonical constructor (JLS {@jls + * 8.10.4.1}, {@jls 8.10.4.2}), it is included in the returned array. + * * This method returns an array of length 0 if this {@code Class} * object represents an interface, a primitive type, an array class, or * void. * - *
See The Java Language Specification,
- * section {@jls 8.2}.
- *
* @return the array of {@code Constructor} objects representing all the
* declared constructors of this class
* @throws SecurityException
@@ -2575,6 +2578,7 @@ public Method[] getDeclaredMethods() throws SecurityException {
*
*
* @since 1.1
+ * @see #getConstructors()
* @jls 8.8 Constructor Declarations
*/
@CallerSensitive
@@ -2736,7 +2740,7 @@ List