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

Nizar Benalla nbenalla at openjdk.org
Wed Jun 5 14:57:26 UTC 2024


On Wed, 5 Jun 2024 14:54:56 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 String::format for simple concatenation

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 -> runtimeHelperName() + ".C_BOOL";

Tiny change to avoid additional fixes in the future

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

> 388: 
> 389:     private String emitOffsetFieldDecl(Declaration.Variable field, String javaName) {
> 390:         String offsetFieldName = javaName + "$OFFSET";

Here too

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

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


More information about the jextract-dev mailing list