RFR: 8336856: Optimize String Concat [v11]

Chen Liang liach at openjdk.org
Mon Aug 12 18:57:40 UTC 2024


On Thu, 25 Jul 2024 00:43:09 GMT, Shaojin Wen <duke at openjdk.org> wrote:

>> The solution is to call `.erase()` on the input method handle, and call `viewAsType` on the result method handle.
>
> Sorry, I don't understand what you mean. The following code can't solve the above build error
> 
> 
> public static CallSite makeConcatWithConstants() {
> // line 383
>                 return new ConstantCallSite(
>                         SimpleStringBuilderStrategy.generate(lookup, concatType, constantStrings)
>                                 .viewAsType(concatType, true));

Even something like `new Lookup(String.class)` is better for encapsulation.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20273#discussion_r1714233628


More information about the core-libs-dev mailing list