Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 370552

Summary: [doc] update doc of null analysis for fields
Product: [Eclipse Project] JDT Reporter: Ayushman Jain <amj87.iitr>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: VERIFIED INVALID QA Contact:
Severity: minor    
Priority: P3 CC: srikanth_sankaran, stephan.herrmann
Version: 3.8   
Target Milestone: 3.8 M6   
Hardware: All   
OS: All   
Whiteboard:

Description Ayushman Jain CLA 2012-02-03 09:20:39 EST
The null ansalysis for fields currently has some limitations
- there's no analysis for fields of objects other than 'this' (this is however solved by applying null annotations)
- the analysis does not deal with aliases

Quoting from bug 369487
-  We need to make sure that right expectations are set by documenting
that it is only the receiver object whose fields get analyzed (add
the other nuances here). I myself was surprised by this during my testing.
Once you know the details of the implementation you can see why that
is the case, but for an end user it will be a surprise too.

- The current implementation basically
adopts the ostrich approach when it comes to aliases. This may
be OK since we only report potential problems/warnings.
For example, the warning below is most likely bogus:

// ---
public class X {
    Object field;
    void goo(X x) {
        X that = this;
    if (this.field == null) {
        that.field = new Object();
        this.field.toString();  // potential NPE warning here.
    }
    }
}
// ---

We don't have any infrastructure for alias analysis and so this
will have to be documented as a known limitation.

Once bug 331649 is fixed, the documentation should be suitably revised and all limitations noted down.
Comment 1 Srikanth Sankaran CLA 2012-02-16 08:34:38 EST
As the implementation from https://bugs.eclipse.org/bugs/show_bug.cgi?id=247564
has been withdrawn, the current bug has lost its relevance and can be
closed as INVALID.
Comment 2 Stephan Herrmann CLA 2012-03-12 16:57:21 EDT
Verified for 3.8 M6.