RFR: 8339704: Refactor StringConcatHelper simpleConcat [v2]
Shaojin Wen
swen at openjdk.org
Sun Sep 8 14:47:08 UTC 2024
On Sun, 8 Sep 2024 13:31:53 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java
>>
>> Co-authored-by: Claes Redestad <claes.redestad at oracle.com>
>
> src/java.base/share/classes/java/lang/StringConcatHelper.java line 731:
>
>> 729: @ForceInline
>> 730: static String concat(String prefix, float value, String suffix) {
>> 731: if (prefix == null) prefix = "null";
>
> Since we'll never bind in `null` values all these `prefix == null` are likely redundant unless we expose them to users. Which we probably shouldn't. It's a good thing this PR actually removes some shared secrets rather than adding new ones.
String concatenation is required in many places in java.lang. These static concat methods will be used instead of "+", so null value processing is added. This is also the motivation for using static concat methods instead of Concat1.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20726#discussion_r1749256205
More information about the core-libs-dev
mailing list