Are Immortal Libraries Ready for Immutable Classes?
summary
Argues that many Java libraries still trip up constructor‑based immutable classes: Jackson needs either per‑field @JsonProperty or @ConstructorProperties metadata, Lombok significantly reduces boilerplate and can generate builders and constructor metadata, Java records help but aren’t a silver bullet, Hibernate supports @Immutable but still allows deletes or native updates unless configuration throws, and Mockito requires Mockito 2+ to mock finals. Shows a staged rocket lifecycle implemented as multiple immutable types with a type‑safe builder and says performance worries are often overstated.
AI-written summary · about
chapters (19)
- 0:00Introduction to talk
- 0:31Mutable classes pros and cons
- 5:35Immutability basics and disclaimers
- 7:01Tools for immutable classes
- 8:46Constructor properties annotation
- 9:50Reasons for mutability in Java
- 13:07Constructor-based dependency injection
- 15:13Property injection with DTOs
- 17:23JPA entities and immutability
- 20:55Performance and immutability myths
- 23:25Functional programming and immutability
- 24:30Value objects and data types
- 26:16Java ecosystem evolution
- 27:21Deserializing to immutable classes
- 29:53Modifying immutable objects
- 31:39State machines with immutable classes
- 34:29Testing final classes with Mockito
- 35:55Mocking and constructor-based classes
- 37:00Summary and main message
