On Fri, 28 Oct 2022 17:57:30 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: > > Update TemplateRuntime::combine src/java.base/share/classes/java/lang/template/TemplateRuntime.java line 289: > 287: try { > 288: MethodHandles.Lookup lookup = MethodHandles.lookup(); > 289: MethodHandle getter = > lookup.findStatic(TemplateRuntime.class, "getValue", This should be a constant (using the class holder idiom or not) src/java.base/share/classes/java/lang/template/TemplateRuntime.java line 302: > 300: > 301: /** > 302: * Private ethod used by {@link > TemplateRuntime#valueGetters(StringTemplate)} Private "method" src/java.base/share/classes/java/lang/template/TemplateRuntime.java line 325: > 323: * @throws NullPointerException fragments or values is null or if > any of the fragments is null > 324: */ > 325: static String interpolate(List<String> fragments, List<Object> > values) { I think it should be better to ensure that the caller always call with a List.of() or a List.copyOf() so null is not a possible element src/java.base/share/classes/java/lang/template/TemplateRuntime.java line 389: > 387: } > 388: } > 389: return new > SimpleStringTemplate(java.lang.template.TemplateRuntime.toList(fragments), > java.lang.template.TemplateRuntime.toList(values)); It seems that IntelliJ was lot when auto-completing or doing a refactoring given that you are alreay in the class TemplateRuntime. ------------- PR: https://git.openjdk.org/jdk/pull/10889