RFR: 7903727: Remove the reliance on String Templates feature

Maurizio Cimadamore mcimadamore at openjdk.org
Mon May 20 10:13:13 UTC 2024


On Mon, 20 May 2024 09:17:22 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:

> This PR aims to replace the usage of string templates with `String::format`, since there will be no string template feature in JDK 23.
> I tried to keep similar indentation and convert them in-place, to make reviewing the changes easier.

src/main/java/org/openjdk/jextract/impl/HeaderFileBuilder.java line 573:

> 571:             emitDocComment(declaration);
> 572:             appendLines(String.format("""
> 573:         public static %s %s() {

Why the negative indentation here? (also in the code below)

src/main/java/org/openjdk/jextract/impl/StructBuilder.java line 325:

> 323:             }
> 324:             """,
> 325:             arrayParam, arrayParam, arrayParam, arrayParam, arrayParam));

In this case, using a `MessageFormat`-like approach is particularly convenient (as there would be just one param)

-------------

PR Review Comment: https://git.openjdk.org/jextract/pull/244#discussion_r1606547765
PR Review Comment: https://git.openjdk.org/jextract/pull/244#discussion_r1606550761


More information about the jextract-dev mailing list