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

Remove the String Templates preview feature

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P2 P2
    • 23
    • core-libs
    • None
    • source, binary
    • medium
    • String templates previewed in Java 21 and 22, so there is a risk that projects might have started to use them. Such projects will need to be rewritten without string templates.
    • Java API, Language construct
    • SE

      Summary

      Remove support for the preview feature "String Templates" from the Java compiler and the Java API.

      Problem

      String templates were previewed in Java 21 (JEP 430) and re-previewed in Java 22 (JEP 459). After some experience with the prototype, it became clear that the processor-centric nature of the proposed design was confusing to users and lacked the desired compositionality. These problems were described in a post on the amber-spec-experts mailing list:

      https://mail.openjdk.org/pipermail/amber-spec-experts/2024-April/004106.html

      Solution

      As there's no clear consensus on how to re-design the feature, we have come to the position that it would be more prudent to drop it for the time being. String templates will not be a feature of Java 23, even as a preview feature.

      Specification

      Specdiff: https://cr.openjdk.org/~mcimadamore/jdk/8329948/v2/specdiff_out/overview-summary.html

        1. specdiff_v1.zip
          17.67 MB
        2. specdiff_v2.zip
          17.86 MB

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Alex Buckley, Jan Lahoda, Mark Reinhold
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: