changeset 58705:324698b7993f records

fixes to APIs after CSR review
author vromero
date Mon, 25 Nov 2019 15:19:12 -0500
parents 2004968341ac
children 53c49cd8e2e5
files src/java.base/share/classes/java/lang/Record.java src/java.base/share/classes/java/lang/reflect/RecordComponent.java src/java.base/share/classes/java/lang/runtime/ObjectMethods.java
diffstat 3 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/Record.java	Mon Nov 25 17:15:36 2019 +0000
+++ b/src/java.base/share/classes/java/lang/Record.java	Mon Nov 25 15:19:12 2019 -0500
@@ -105,9 +105,9 @@
      * The implicitly provided implementation returns {@code true} if and
      * only if the argument is an instance of the same record type as this object,
      * and each component of this record is equal to the corresponding component
-     * of the argument, according to {@link java.util.Objects#equals(Object,Object)} for components
-     * whose types are reference types, and the primitive wrapper equality
-     * comparison for components whose types are primitive types.
+     * of the argument, according to {@link java.util.Objects#equals(Object,Object)}
+     * for components whose types are reference types, and according to the semantics
+     * of the {@code equals} method on the corresponding primitive wrapper type.
      *
      * @see java.util.Objects#equals(Object,Object)
      *
@@ -119,7 +119,7 @@
     public abstract boolean equals(Object obj);
 
     /**
-     * {@inheritDoc}
+     * Obeys the general contract of {@link Object#hashCode Object.hashCode}.
      *
      * @implSpec
      * The implicitly provided implementation returns a hash code value derived
@@ -136,7 +136,7 @@
     public abstract int hashCode();
 
     /**
-     * {@inheritDoc}
+     * Obeys the general contract of {@link Object#toString Object.toString}.
      *
      * @implSpec
      * The implicitly provided implementation returns a string that is derived
--- a/src/java.base/share/classes/java/lang/reflect/RecordComponent.java	Mon Nov 25 17:15:36 2019 +0000
+++ b/src/java.base/share/classes/java/lang/reflect/RecordComponent.java	Mon Nov 25 15:19:12 2019 -0500
@@ -153,16 +153,12 @@
     }
 
     /**
-     * Returns an {@code AnnotatedType} that represents the use of a type to
-     * specify the annotated type of this record component.
+     * Returns an {@code AnnotatedType} object that represents the use of a type to specify
+     * the declared type of this record component.
      *
      * @return an object representing the declared type of this record component
      */
     public AnnotatedType getAnnotatedType() {
-        if (typeAnnotations != null) {
-            // debug
-            // System.out.println("length of type annotations " + typeAnnotations.length);
-        }
         return TypeAnnotationParser.buildAnnotatedType(typeAnnotations,
                 SharedSecrets.getJavaLangAccess().
                         getConstantPool(getDeclaringRecord()),
--- a/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java	Mon Nov 25 17:15:36 2019 +0000
+++ b/src/java.base/share/classes/java/lang/runtime/ObjectMethods.java	Mon Nov 25 15:19:12 2019 -0500
@@ -309,8 +309,12 @@
      * {@link java.lang.Record#toString()}.
      *
      *
-     * @param lookup       Represents a lookup context with the accessibility
-     *                     privileges of the caller.
+     * @param lookup       Every bootstrap method is expected to have a {@code lookup}
+     *                     which usually represents a lookup context with the
+     *                     accessibility privileges of the caller. This is because
+     *                     {@code invokedynamic} call sites always provide a {@code lookup}
+     *                     to the corresponding bootstrap method, but this method just
+     *                     ignores the {@code lookup} parameter
      * @param methodName   the name of the method to generate, which must be one of
      *                     {@code "equals"}, {@code "hashCode"}, or {@code "toString"}
      * @param type         a {@link MethodType} corresponding the descriptor type