On Tue, 27 Aug 2024 10:09:09 GMT, Shaojin Wen <s...@openjdk.org> wrote:
> The string concatenation of the java.base module is implemented using > StringBuilder. By providing a series of concat methods in StringConcatHelper, > it is used in the java.lang package to replace string concatenation. > > These concat methods can also be exposed through JLA for use by other > packages, such as java.lang.constant. > > These concat methods can replace Concat1 and become part of > StringConcatFactory#simpleConcat 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. src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 518: > 516: mh = MethodHandles.insertArguments(mh, 2, suffix); > 517: return MethodHandles.insertArguments(mh, 0, prefix); > 518: } else if (paramCount == 2 && constants[1] == null) { All `constants` are non-null (see `parseRecipe`) Suggestion: } else if (paramCount == 2 && constants[1].isEmpty()) { ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20726#discussion_r1749234619 PR Review Comment: https://git.openjdk.org/jdk/pull/20726#discussion_r1749233891