| Summary: | [correlation][null]Incorrect "Potential Null Pointer Access" warning | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Carsten Friedrich <Carsten.Friedrich> |
| Component: | Core | Assignee: | JDT Core Triaged <jdt-core-triaged> |
| Status: | VERIFIED WONTFIX | QA Contact: | Ayushman Jain <amj87.iitr> |
| Severity: | minor | ||
| Priority: | P3 | CC: | amj87.iitr, stephan.herrmann |
| Version: | 3.8 | ||
| Target Milestone: | 4.7 M1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
This is a part of correlation analysis which is currently not supported. In this case nullness of b is related to nullness of a Bulk closing all compiler bugs tagged [null][correlation], because we have no plans to add such a feature: it would be a tremendous implementation effort, beyond our current man power, and may be impossible to achieve within the desired performance bounds. If s.o. has a viable strategy or even implementation for such a feature, I'm all ears. Verified for 4.7 M1. |
Build Identifier: Build id: 20110615-0604 The following code gives a "Potential Null Pointer Access" warning for the line "b.toString()" although "b" can't possibly be null at that point. Note that the example is artificial to make it concise (and thus does not make much sense), but based on a real-world case (in which cond, c, cond2, and d are not parameters but computed in the while loop) with the same problem. public class FalseWarning { static void f(boolean cond, Object c, boolean cond2, Object d) { while (true) { Object a=null; Object b=null; if(cond) { a=c; } if(cond2) { b=d; } if (a == null && b == null) break; if (a == null) b.toString(); } } } Reproducible: Always Steps to Reproduce: 1. Create new Java Project 2. Create class with content listed above