r/foojay • u/FrankCodeWriter • 2h ago
Finally final: embracing JEP 500 and what it means for serializers
On Foojay we published an article by Harald Krake about JEP 500, Prepare to Make Final Mean Final. Since JDK 26, writing a final field through deep reflection still works but prints a warning. A future release will switch the default to deny, and the same call will then throw an IllegalAccessException.
The article explains what this means for serializers, which have long relied on reflection to fill final fields. Harald shows how Tentackle's TRIP protocol now never writes a final field. Only the edges that close a cycle need to be mutable, and everything else can go through a constructor, as records do.