Summary: | Potential Null pointer access and the assert keyword | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Laurent Goubet <laurent.goubet> |
Component: | Core | Assignee: | Ayushman Jain <amj87.iitr> |
Status: | VERIFIED WORKSFORME | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | amj87.iitr, remy.suen, satyam.kandula |
Version: | 3.7 | ||
Target Milestone: | 3.7 M5 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Whiteboard: |
Description
Laurent Goubet
2011-01-19 05:33:32 EST
By default, we assume that asserts are not enabled at runtime, and we do our null analysis based on that assumption. So, in this piece of code, the presence of assert statement makes no difference to the analysis. And indeed, without the assert, the variable test can potentially be null. So this is correct. Check out the new compiler error/warning preference "include assert in null analysis" in the preferences>java>compiler>errors/warnings. If you enable it, the warning goes away, as you wanted! Marking as WORKSFORME, since there's no warning when the option is turned on. Thanks, this kind of option is indeed what I sought :). Verified for 3.7M5 using build I20110124-1800 |