Robert

21%
Flag icon
Make all fields final. This clearly expresses your intent in a manner that is enforced by the system.
Robert
Unfortunately, modern frameworks — such as many dependency injection frameworks — work against this (can't mark fields that would otherwise be initialized in the constructor and be final, but are initialized by DI). It would be great for an update to the language to allow this.
Effective Java
Rate this book
Clear rating
Open Preview