Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8235428

Class.toGenericString need to be updated for records

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 14
    • core-libs
    • None
    • behavioral
    • minimal
    • Java API
    • SE

      Summary

      Update Class.toGenericString to account for records.

      Problem

      A record type has a printed representation using class rather than record.

      Solution

      Update the specification and implementation. Note that in the interests of behavioral compatibility, Class.toString is not being updated.

      Specification

      --- a/src/java.base/share/classes/java/lang/Class.java  Wed Dec 04 14:55:15 2019 -0800
      +++ b/src/java.base/share/classes/java/lang/Class.java  Thu Dec 05 10:01:26 2019 -0800
      @@ -207,8 +207,8 @@
            *
            * 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>&#64;</code>{@code interface}, as appropriate), followed
      +     * and {@code class}, {@code enum}, {@code interface},
      +     * <code>&#64;</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.

            darcy Joe Darcy
            darcy Joe Darcy
            Chris Hegarty
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: