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

Compiler Implementation for Unnamed Variables & Patterns

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 22
    • tools
    • None
    • source
    • minimal
    • Java API, Language construct
    • SE

      Summary

      JEP 443 previewed the Java language with unnamed variables, which can be initialized but not used, and unnamed patterns, which match a record component without stating the component's name or type. Both are denoted by an underscore character, _. We propose to make this feature final and permanent.

      Problem

      Since no changes were requested we propose to make the feature final and permanent.

      Solution

      No essential implementation changes are proposed apart from removing the --enable-preview protection and making the Tree API for underscore (AnyPatternTree) permanent. The removal of the @PreviewFeature will be the only part of the API changes.

      The javax.lang.model will be also finalized accordingly. The previous changeset was tracked in a separate CSR: 8307577: Implementation for javax.lang.model for unnamed variables (Preview).

      Specification

      The specification draft was reviewed under CSR JDK-8304246. There are no new updates to the specification.

      The previously proposed API enhancements are not enhanced or altered. The preliminary specdiff will be attached as 8315851.specdiff.zip.

      The changes to the specification and API are a subject of change until the CSR is finalized.

        1. JLS-unnamed.pdf
          1.69 MB
          Angelos Bimpoudis
        2. JLS-unnamed-1.pdf
          1.78 MB
          Angelos Bimpoudis

            abimpoudis Angelos Bimpoudis
            abimpoudis Angelos Bimpoudis
            Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: