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/Mauer_Bluemchen Apr 30 '26 edited Apr 30 '26

Exactly...

Or you e. g. allocate arrays with the size of a given final static int value. If this value gets modified later on with reflection -> bang!