This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Example: void foo(String text) { boolean haveText = (text != null && text.length() > 0); System.out.println(haveText); if (haveText) { System.out.println(text.toUpperCase()); } } "Dereferencing possible null pointer" is shown on the toUpperCase() call although clearly 'text' can never be null here. The warning disappears when moving the condition expression to the 'if' clause, but that is not a solution in situations where the result of the condition test is used multiple times, if one wants to avoid code duplication or if the test may be costly (which are the reasons for storing the result in a boolean variable).
In order to properly use information from the haveText value expression, one would need to maintain variant sets of null/non null states for variables used in expressions; the current code is not designed that way. Will implement if time permits.
Fixed in the experimental implementation; please wait for the umbrella issue to close.