| Summary: | [compiler][null][correlation] two variables synchronized null status | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | x y <m8r-eehfmm> | ||||
| Component: | Core | Assignee: | Ayushman Jain <amj87.iitr> | ||||
| Status: | CLOSED DUPLICATE | QA Contact: | |||||
| Severity: | enhancement | ||||||
| Priority: | P5 | CC: | stephan.herrmann | ||||
| Version: | 3.2 | Keywords: | helpwanted | ||||
| Target Milestone: | 4.7 M1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 36103 [details]
screenshot with problem code and warning
The proposed code warns upon b, with a "may be null" message. b is tainted by the first test, which tells the analysis that the developer thinks that b may be null. A human reader recognizes that b.length is a legitimate call is all cases because at the call point, a != null and per the first condition, then b != null. But our current analysis does not attempt to draw from (a == null) != (b == null) any conclusion regarding a relationship between a and b. (Something like: 'if this expression is true, then a and b have the same null status'.) Hence the warning. This is an expected limitation of the current analysis. It may be reconsidered in the future. Reopening as P5 (since RESOLVED LATER is deprecated). 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 I created a new umbrella RFE outlining what would be needed to address this issue. *** This bug has been marked as a duplicate of bug 538421 *** |
Variable b cannot be null, but Eclipse 3.2M5a doesn't think so :( if ( (a == null) != (b == null) || a != null && a.length != b.length) { // do something }