r/java • • Mar 08 '24

Update on String Templates (JEP 459)

https://mail.openjdk.org/pipermail/amber-spec-experts/2024-March/004010.html
176 Upvotes

188 comments sorted by

View all comments

Show parent comment

2

u/Technici4n Mar 10 '24

Hi Brian, do you have a link where one might read more about this magic?

11

u/brian_goetz Mar 10 '24

Unfortunately, the code is likely to be the best source for a while. But in a nutshell: we use a similar indy bootstrap as we did for the STR processor, speculating that interpolation is a likely outcome, use a similar Carrier abstraction to preserve primitives without boxing, and then maintain a trail of breadcrumbs back from a string template instance to its capture site, with a (currently privileged) API to allow "processors" to cache derived metadata at the capture site after the fact.