Bug 129122

Summary: [compiler][null] false positives inside loop
Product: [Eclipse Project] JDT Reporter: Max Gilead <max.gilead>
Component: CoreAssignee: Maxime Daniel <maxime_daniel>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.2 M6   
Hardware: All   
OS: All   
Whiteboard:

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.