On Sun, 25 May 2025 04:40:44 GMT, Chen Liang <[email protected]> wrote:
>> Shaojin Wen has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> create method share variant val & coder
>
> src/java.base/share/classes/java/lang/String.java line 569:
>
>> 567: }
>> 568: this.value = str.value;
>> 569: this.coder = str.coder;
>
> Suggestion:
>
> this(str);
>
> We have integrated flexible constructor bodies.
public String(String original) {
this.value = original.value;
this.coder = original.coder;
this.hash = original.hash;
this.hashIsZero = original.hashIsZero;
}
this(str) It will lead to more operations, which are not necessary here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25290#discussion_r2106083905