~/talk

Pattern Matching in Java: Past, Present, Future

Talkat Devoxx Belgium 2024 · 2024-10-07..10-11· [java, compilers-and-language-design]
links:none on file
slides:none on file

Pattern matching becomes concrete: JDK 16 instanceof patterns introduces safe cast-and-bind; switch expressions with patterns (JDK 21) enables multi‑way, exhaustive branching over reference types and records; six JEPs drive the work via Project Amber. Primitive patterns arrive as a preview (JDK 23), adding magnitude/precision safeguards so casts no longer silently lose data. Proposals add deconstructors and withers for class construction/deconstruction, yielding composable serialization and compile‑time exhaustiveness that prevents many runtime ClassCastExceptions or unexpected variants.

AI-written summary · about

  1. 0:00Introduction to patterns
  2. 1:41Traditional vs modern code
  3. 3:51Defining pattern matching
  4. 7:27Pattern matching evolution
  5. 10:28Instanceof patterns
  6. 13:11Switch statements limitations
  7. 15:21Switch expressions
  8. 17:03Patterns in switch
  9. 19:09Record patterns
  10. 21:53Sealed classes
  11. 24:12Exhaustiveness and safety
  12. 28:43Unnamed variables and patterns
  13. 32:40Primitives in patterns
  14. 35:28Safeguarding conversions
  15. 39:08Advanced pattern matching
  16. 42:05Improving APIs
  17. 44:35Record deconstruction
  18. 45:23Construction of classes
  19. 46:15Deconstruction of classes
  20. 48:14Record reconstruction
  21. 49:20Class reconstruction
  22. 50:31Serialization mechanism
  23. 52:45Conclusion
~/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.