RFR: 7903727: Remove the reliance on String Templates feature [v7]

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Jun 5 13:31:20 UTC 2024


On Wed, 5 Jun 2024 11:26:38 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.
>
> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
> 
>   - remove whitespace
>   - fix doc comment

src/main/java/org/openjdk/jextract/impl/ClassSourceBuilder.java line 243:

> 241:     private String primitiveLayoutString(Primitive primitiveType, long align) {
> 242:         return switch (primitiveType.kind()) {
> 243:             case Bool -> String.format("%1$s.C_BOOL", runtimeHelperName());

is this more readable than `runtimeHelperName() + ".C_BOOL"` ? I know this is all subjective, but we have a lot of "simple" concatenation which now is using `String::format`. Perhaps worth cleaning up in a separate PR.

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

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


More information about the jextract-dev mailing list