Bug 212013

Summary: [compiler][null] Wrong potential null pointer access warning
Product: [Eclipse Project] JDT Reporter: Benno Baumgartner <benno.baumgartner>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: jerome_lanneluc, Olivier_Thomann, srikanth_sankaran
Version: 3.3   
Target Milestone: 3.6 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Benno Baumgartner CLA 2007-12-05 10:35:09 EST
I20071204-1547

Given:
package test;
import java.util.ArrayList;
public class Test1 {
	public void foo() {
		ArrayList list= new ArrayList();
		while (bar()) {
			if (list != null && bar()) {
				list.add(null);
			}
		}
		if (list.isEmpty()) {
			
		}
	}

	private boolean bar() {
		return false;
	}
}

1. Enable 'Potential null pointer access' warning
2. Enable 'Redundant null check' warning
Is:
  A potential null pointer access warning at 'list.isEmpty()': The variable list may be null'
Should:
 Redundant null check warning at 'list != null' check
Comment 1 Maxime Daniel CLA 2007-12-05 11:31:13 EST
I believe this is a variation on bug 190737. Thanks for the test case. I'll add it when we tackle the other bug.

*** This bug has been marked as a duplicate of bug 190737 ***
Comment 2 Srikanth Sankaran CLA 2009-12-08 03:38:06 EST
Verified for 3.6M4 using Build id: I20091207-1800