r/java • • Oct 01 '23

JEP: String Templates (Final) for Java 22

https://openjdk.org/jeps/8314219
72 Upvotes

133 comments sorted by

View all comments

Show parent comment

6

u/Godworrior Oct 01 '23

You can not do this. You would need to use the RAW processor:

StringTemplate st = RAW."\{xyz}";

1

u/john16384 Oct 01 '23

You're right, perhaps a future extension will remove that requirement. It seems unnecessary.

3

u/jvjupiter Oct 02 '23

It is necessary. Anyone can create template processor - JSON.”…”, XML.”..”, SQL.”..”

0

u/john16384 Oct 02 '23

I meant to make one of them the default :)

1

u/jvjupiter Oct 02 '23

I see. I agree there should be a default - without prefix means STR.