Bug 129122 - [compiler][null] false positives inside loop
Summary: [compiler][null] false positives inside loop
Status: VERIFIED DUPLICATE of bug 128014
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Maxime Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-23 04:06 EST by Max Gilead CLA
Modified: 2006-03-28 06:12 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Max Gilead CLA 2006-02-23 04:06:29 EST
I believe below error is detected incorrectly:

public class Test {
  String getString() { return ""; }
  void foo() {
    String string = null;
    while (true) {
      string = getString();
      if (string != null) {
        string = "";
      }
      string = null; // The variable string can only be null; it was either set to null or checked for null when last used
}}}

Tested with Build id: I20060221-1300
Comment 1 Maxime Daniel CLA 2006-02-23 04:22:24 EST
Reproduced.
Comment 2 Maxime Daniel CLA 2006-03-23 08:58:07 EST
Added test case NullReferenceTest #454.
Already fixed in HEAD. I believe this is a duplicate of bug 128014 (checking...).
Comment 3 Maxime Daniel CLA 2006-03-23 09:07:44 EST

*** This bug has been marked as a duplicate of 128014 ***
Comment 4 Frederic Fusier CLA 2006-03-28 06:12:52 EST
Verified for 3.2 M6 using warm-up build I20060327-0010.