| Summary: | [compiler][null] Problem in propagating null defaults. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Srikanth Sankaran <srikanth_sankaran> | ||||
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | amj87.iitr | ||||
| Version: | 3.8 | ||||||
| Target Milestone: | 3.8 M5 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Srikanth Sankaran
Is this case already captured in a bug?
@NonNullByDefault
public class ShowNPE2 {
public Object foo(Object o1, final boolean b) {
o1 = null; // MISSING NPE warning
System.out.println(o1.toString());
return null; // Correct warning
}
}
(In reply to comment #1) > Is this case already captured in a bug? I don't think so. Stephan spawn another bug as needed. TIA. Created attachment 208628 [details] test & fix (In reply to comment #0) > This is a follow up to bug 365836. > > In the following program, I would expect to see an error, but don't. Thanks. When fixing bug 365836 I wasn't aware that types nested in local types are also treated as local types. This implies that enclosingType and enclosingMethod cannot easily be used to determine lexical scoping. Obviously, the better strategy is to use scopes for this traversal. The attached fix does this. The tiny downside of this approach is that expressions like scope.referenceContext.binding can yield nulls in various situations, which all have to be checked. Test's are currently running. (In reply to comment #2) > (In reply to comment #1) > > Is this case already captured in a bug? > > I don't think so. Stephan spawn another bug as needed. TIA. See bug 367203. (In reply to comment #3) > Test's are currently running. Aggressive version of all JDT/Core tests (ie., with null analysis enabled by default) essentially pass (except for obvious deviation like in BatchCompilerTest). Released for 3.8 M5 via commit 191f90d8b8e3d032d6a88890167c13d9311990d0 Verified for 3.8 M5 using build id: I20120122-2000 |