Synopsis: | Never initialize a final field to null |
Language: | Java |
Severity Level: | 1 |
Category: | Design |
Description: |
Final fields can only be written to once. If a final field is initialized explicitly to null, it cannot be used anymore for a proper reason. This is probably a mistake.
class Foo { final Bar b = null; } |