~/talk

Robust and Flexible String Templates in Java

Talkat JCON EUROPE 2024 · 2024-05-13..05-16· [java]
slides:none on file

Java 21/22 ships preview string templates that embed expressions in text blocks using a backslash syntax; the JDK provides three processors (StStr, fmt, raw) and custom processors can return any type (examples: a SQL processor that builds PreparedStatement and binds parameters to produce ResultSet, and a JSON processor that returns parsed objects). The feature is preview-only, removed from OpenJDK 23 pending redesign, and current limits include no dynamic map-lookups, inability to load templates from files, and the need to sanitize inputs to avoid injection.

AI-written summary · about

  1. 0:00Introduction to talk
  2. 1:49Why strings matter in Java
  3. 3:14What is string interpolation
  4. 6:30History of string handling in Java
  5. 7:34String templates in Java 21
  6. 8:17Problems with current string concatenation
  7. 10:02SQL injection risks with strings
  8. 12:38Security threats in string interpolation
  9. 14:46Handling injection with frameworks
  10. 15:08Preview feature warning
  11. 16:58Java release model explained
  12. 17:22Basic string template syntax
  13. 19:30Text blocks with string templates
  14. 20:35Built-in string processors
  15. 22:45How string template processing works
  16. 24:40Java Almanac and JDK changes
  17. 26:11Creating custom processors
  18. 29:25SQL processor example
  19. 32:44JSON processor example
  20. 34:53Benefits of custom processors
  21. 35:16Surprising email from Brian Goetz
  22. 36:18String templates future status
  23. 39:28Should you use string templates now
  24. 43:28Conclusion and benefits summary
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.