| Summary: | [compiler][null] false positive null reference with boolean logical & | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Thierry Monney <thierry.monney> |
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | minor | ||
| Priority: | P5 | CC: | chalin, h.klene, stephan.herrmann |
| Version: | 3.3 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | stalebug | ||
Reproduced with I20070625-1500. In fact, it seems that boolean expressions else than boolean shortcut expressions have received insufficient attention. Further investigations unveiled that the && case works because of the opportunistic reuse of ConditionalFlowInfo by the null analysis, which is not a viable option for the & case. Since the severity is minor and the fix would need significant changes, deferring. Still relevant in 3.7M5 I'll take a look. Reproduced with: Version: 4.3.0 Build id: I20130605-2000 This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. Please reopen - Still an issue in: Version: 2019-03 (4.11) Build id: I20190301-0040 (In reply to Holger Klene from comment #7) > Please reopen - Still an issue in: > Version: 2019-03 (4.11) > Build id: I20190301-0040 Please understand that we do have to set priorities in fixing bugs. So when this bug got closed automatically, I briefly scanned the situation and decided that using '&' to join boolean operands is not a particular common nor useful idiom. Before we re-open, you'd need to convince me of the high relevance of '&' for boolean values. :) |
The followin code gives warnings when the potential null reference preference is enabled: public void foo(Object a, Object b) { if (a != null & b != null) { System.out.println(a.toString() + b.toString()); } } The same code using the logical && does not show the warning.