On Wed, 10 Apr 2024 10:44:13 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

>> src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 
>> 120:
>> 
>>> 118:      * @since 21
>>> 119:      */
>>> 120:     public static final int MAX_INDY_CONCAT_ARG_SLOTS;
>> 
>> May this value change in the future? If yes, we might change this to a 
>> method to avoid incorrect eager inlining by the java compiler, or drop this 
>> with string templates.
>
> Good catch. Since this was tweaked to be a public API as part of the string 
> template feature, I've reverted this code to what it was prior to string 
> template. That is, now this is a private static final constant, with 
> initializer set to 200 (no need to inhibit javac constant folding, since all 
> uses are from this file).

Just for completeness - note the field is not initialized in its initializator, 
but using a static init below. Fields like this are not inlined as constants by 
javac - that would require the value to be provided in the field initializator.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18688#discussion_r1559643723

Reply via email to