<i18n dev> RFR: JDK-8285932 Implementation of JEP 430 String Templates (Preview) [v21]

Jim Laskey jlaskey at openjdk.org
Thu Nov 17 15:59:49 UTC 2022


On Tue, 15 Nov 2022 22:23:27 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Wrong line separator
>
> src/java.base/share/classes/java/lang/AbstractStringBuilder.java line 1826:
> 
>> 1824: 
>> 1825:     // Used by StringConcatHelper via JLA.
>> 1826:     long mix(long lengthCoder) {
> 
> `mix` is not a very descriptive name (in all of the places it is used).
> Perhaps a name that captures the combination of coder and length.
> 
> `coderAndLength()` or similar
> 
> The implementation here can do the wrong thing if the `lengthCoder` already includes the bit for UTF16
> and the coder for the AbstractStringBuilder is LATIN1. Or is intentional that it will upgrade to UTF16?
> That could definately use a comment.

The goal here is to take the contents of a `StringBuilder/StringBuffer `without first converting to a string when referenced by `StringConcatFactory`. So the terminology is a carry over from `StringConcatFactory` and `StringConcatHelper`.

I agree `mix` is weird but historically, it is what it is. Maybe a separate task to rename is in order.

The implementation is deliberate. If something in the list of things being concatenated is UTF16, then everything being concatenated is upgraded to UTF16.

I'll add commentary.

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

PR: https://git.openjdk.org/jdk/pull/10889


More information about the i18n-dev mailing list