New candidate JEP: 430: String Templates (Preview)

Brian Goetz brian.goetz at oracle.com
Tue Sep 20 20:11:16 UTC 2022


> Hi all.
> My main concern is that the TemplatedString object erase the types, but apart trivial template processors, those types is either required or can be used in order to be more efficient.

While the types may be erased to Object[], the dynamic types are 
available to template processors.  So processors that "require" types 
have no problem, they just have to use `instanceof` and similar.  As to 
performance, yes, we would like a path to making user-written processors 
as efficient as we are able to make the JDK ones, but we've chosen to 
come back for that in a later round if need be.  The semantics are in 
place; we can make it more efficient later.  Java developers have waited 
a long time already for this functionality, and I don't want to delay it 
further just so we can make the advanced cases more efficient.



More information about the jdk-dev mailing list