Linked by Thom Holwerda on Fri 14th Sep 2012 02:30 UTC, submitted by MOS6510

Permalink for comment 535254
To read all comments associated with this story, please click here.
To read all comments associated with this story, please click here.
Member since:
2005-07-24
This is true, but only for local variables.
For fields, there may be cases where an object needs to be kept alive, but one of its fields can be discarded, so setting it to NULL is advantageous. Static analysis won't help there, taking into account Java has a reflection API. Indeed, though, such cases are probably rare, and a form of code smell in the first place.