Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370552 - [doc] update doc of null analysis for fields
Summary: [doc] update doc of null analysis for fields
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: 3.8 M6   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-03 09:20 EST by Ayushman Jain CLA
Modified: 2012-03-12 16:57 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.