Tuesday, June 26, 2007

Eclipse can detect null pointer reference

Eclipse has the ability to detect null pointer reference but it's not enable by default. To do so, go to the preferences. In the Java>Compiler>Errors/Warning page, click on "Potential programming problems". There's a "Null reference:" drop list.
You can set it to "Error", "Warning", or "Ignore".

In Eclipse 3.3 there's also a setting for "Potential null pointer access" in the same section.

1 comment:

Anonymous said...

Only thing is that for example in a test Eclipse does not detect that after an assertNotNull it should not give the warning.