This recent optimization manually replaces "" + char with String.valueOf(char): https://github.com/openjdk/jdk/pull/6326
This was in java.base, so the translated bytecode replaced was a StringBuilder chain. In user code this pattern would emit a call into StringConcatFactory, which would be even more excessive since it'll boil down to a call to String.valueOf in the end after a detour through some MethodHandles.
Consider a translation where javac replaces this particular concat expression with a call to String.valueOf() regardless of -XDstringConcat strategy. The pattern is common in existing codebases - including the OpenJDK - so if it's not too much trouble it might be a worthwhile startup optimization.
This was in java.base, so the translated bytecode replaced was a StringBuilder chain. In user code this pattern would emit a call into StringConcatFactory, which would be even more excessive since it'll boil down to a call to String.valueOf in the end after a detour through some MethodHandles.
Consider a translation where javac replaces this particular concat expression with a call to String.valueOf() regardless of -XDstringConcat strategy. The pattern is common in existing codebases - including the OpenJDK - so if it's not too much trouble it might be a worthwhile startup optimization.