RFR: 8329948: Remove string template feature [v4]
Jan Lahoda
jlahoda at openjdk.org
Wed Apr 10 15:20:00 UTC 2024
On Wed, 10 Apr 2024 10:44:13 GMT, Maurizio Cimadamore <mcimadamore at 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
More information about the core-libs-dev
mailing list