<i18n dev> RFR: JDK-8285932 Implementation of JEP 430 String Templates (Preview) [v53]

Rémi Forax forax at openjdk.org
Tue Apr 4 15:24:53 UTC 2023


On Tue, 4 Apr 2023 15:16:19 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> Enhance the Java programming language with string templates, which are similar to string literals but contain embedded expressions. A string template is interpreted at run time by replacing each expression with the result of evaluating that expression, possibly after further validation and transformation. This is a [preview language feature and API](http://openjdk.java.net/jeps/12).
>
> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
> 
>   RuntimeException is the only exception type that can is deduced from a lambda.

src/java.base/share/classes/java/lang/runtime/ReferenceKey.java line 70:

> 68:          * null.
> 69:          */
> 70:         int hashcode;

All the fields of the keys should be final, otherwise a publication problem can occur (the key is visible from another thread but its fields are not yet initialized)

src/java.base/share/classes/java/lang/runtime/StringTemplateImpl.java line 100:

> 98:         try {
> 99:             return (List<Object>)valuesMH.invokeExact(this);
> 100:         } catch (Throwable ex) {

Errors likes OutOfMemoryError and runtime exception should be rethrown instead of being wrapped

src/java.base/share/classes/java/lang/runtime/StringTemplateImpl.java line 109:

> 107:         try {
> 108:             return (String)interpolateMH.invokeExact(this);
> 109:         } catch (Throwable ex) {

see above

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

PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1157415311
PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1157417666
PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1157417849


More information about the i18n-dev mailing list