On Tue, 4 Apr 2023 16:07:54 GMT, Jim Laskey <jlas...@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:
> 
>   Recommended changes

These should rethrow all `Error`s:

src/java.base/share/classes/java/lang/StringConcatHelper.java line 364:

> 362:         try {
> 363:             return value.prepend(indexCoder, buf);
> 364:         } catch (Throwable ex) {

This should rethrow errors (such as `OutOfMemoryError`):
Suggestion:

        } catch (Error err) {
            throw err;
        } catch (Throwable ex) {

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

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

Suggestion:

        } catch (RuntimeException | Error ex) {

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

> 109:         try {
> 110:             return (String) interpolateMH.invokeExact(this);
> 111:         } catch (RuntimeException | OutOfMemoryError ex) {

Suggestion:

        } catch (RuntimeException | Error ex) {

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

PR Review: https://git.openjdk.org/jdk/pull/10889#pullrequestreview-1376048871
PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1160580952
PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1160595676
PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1160595790

Reply via email to