Bug 133131 - [compiler][null] missing diagnostic after nested loop
Summary: [compiler][null] missing diagnostic after nested loop
Status: RESOLVED DUPLICATE of bug 127570
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Maxime Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 127570
Blocks:
  Show dependency tree
 
Reported: 2006-03-24 06:36 EST by Maxime Daniel CLA
Modified: 2006-09-26 08:58 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Daniel CLA 2006-03-24 06:36:24 EST
3.2 M6
The following code should raise a warning but does not (NullReferenceTest #451):
class X {
  void foo(boolean b) {
    Object o = new Object();
    while (b) {
      while (b) {
        o = new Object();
      }
    }
    if (o != null) { /* */ } // should complain: o cannot be null
  }
}
Comment 1 Maxime Daniel CLA 2006-03-24 07:08:45 EST
The issue comes from the projection of potential non null onto potential non null/unknown. Assigned non null + potential non null/unknown yields assigned unknown (the most when can tell), which is not enough to detect that o is non null.
Contrast this with test #455, where assigned not null + assigned non null yields assigned non null.
Comment 2 Maxime Daniel CLA 2006-04-25 00:48:12 EDT
Post 3.2.
Comment 3 Maxime Daniel CLA 2006-09-26 08:57:19 EDT
Reopening to mark as duplicate.
Comment 4 Maxime Daniel CLA 2006-09-26 08:58:40 EDT
This bug was fixed along 127570.

*** This bug has been marked as a duplicate of 127570 ***