RFR: 8357289: Break down the String constructor into smaller methods [v3]
Shaojin Wen
swen at openjdk.org
Sun May 25 04:50:08 UTC 2025
On Sun, 25 May 2025 04:40:44 GMT, Chen Liang <liach at openjdk.org> 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
More information about the core-libs-dev
mailing list