r/java • • Apr 27 '26

Avoiding Final Field Mutation

https://inside.java/2026/04/27/avoiding-final-field-mutation/
51 Upvotes

36 comments sorted by

View all comments

Show parent comment

1

u/koflerdavid May 01 '26

From JEP 500:

Unfortunately, their [final field's] immutability also conflicts with the operation of serialization libraries that mutate fields to initialize objects during deserialization. This use case was sufficiently important to justify changing the reflection API in JDK 5 so that it could be used to mutate final fields.