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

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Jun 5 15:05:12 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/HeaderFileBuilder.java line 219:

> 217:                         traceDowncall(%5$s);
> 218:                     }
> 219:                     %6$s mh$.invokeExact(%7$s);

extra space here?

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

> 418:                 %3$s.SEGMENT.set(%4$s.LAYOUT, 0L, varValue);
> 419:             }
> 420:             """, javaName, type.getSimpleName(), holderClass, holderClass);

repeated `holderClass`

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

> 488:                     MemorySegment.copy(varValue, 0L, %1$s(%3$s), 0L, %4$s.byteSize());
> 489:                 }
> 490:                  """, javaName, indexList.decl(), indexList.use(), layoutString(elemType));

changed indentation?

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

> 510:             Type elemType = Utils.typeOrElemType(varType);
> 511:             String accessHandle = Utils.isStructOrUnion(elemType) ?
> 512:                     "public static final MethodHandle HANDLE = LAYOUT.sliceHandle(" + path + ");" :

I note that here we're using string concat

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

PR Review Comment: https://git.openjdk.org/jextract/pull/244#discussion_r1627951515
PR Review Comment: https://git.openjdk.org/jextract/pull/244#discussion_r1627953609
PR Review Comment: https://git.openjdk.org/jextract/pull/244#discussion_r1627956498
PR Review Comment: https://git.openjdk.org/jextract/pull/244#discussion_r1627957334


More information about the jextract-dev mailing list