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

JShell does not handle records properly

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P3
    • 14
    • tools
    • None
    • source, behavioral
    • minimal
    • Changes ordering of existing enum constants.
    • Java API
    • JDK

    Description

      Summary

      jdk.jshell.Snippet.SubKind contains constants for different types of jshell snippets, and differentiated between classes, enums, interfaces and annotations. It should also show records separately.

      Problem

      The jdk.jshell.Snippet.SubKind enum does not contain an enum constant for records.

      Solution

      A new constant, RECORD_SUBKIND, is added into jdk.jshell.Snippet.SubKind.

      Specification

      The exact proposed change is:

      @@ -234,10 +234,27 @@
                * @jls 8.9 Enum Types
                */
               ENUM_SUBKIND(Kind.TYPE_DECL),
      
               /**
      +         * {@preview Associated with records, a preview feature of the Java language.
      +         *
      +         *           This enum constant is associated with records, a preview
      +         *           feature of the Java language. Preview features
      +         *           may be removed in a future release, or upgraded to permanent
      +         *           features of the Java language.}
      +         *
      +         * A record declaration.
      +         * A {@code SubKind} of {@link Kind#TYPE_DECL}.
      +         * @jls 8.10 Record Types
      +         * @since 14
      +         *
      +         */
      +        @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS)
      +        RECORD_SUBKIND(Kind.TYPE_DECL),
      +
      +        /**
                * An annotation interface declaration. A {@code SubKind} of
                * {@link Kind#TYPE_DECL}.
                * @jls 9.6 Annotation Types
                */
               ANNOTATION_TYPE_SUBKIND(Kind.TYPE_DECL),
      
      

      Attachments

        Issue Links

          Activity

            People

              jlahoda Jan Lahoda
              jlahoda Jan Lahoda
              Vicente Arturo Romero Zaldivar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: