Bug 212013 - [compiler][null] Wrong potential null pointer access warning
Summary: [compiler][null] Wrong potential null pointer access warning
Status: VERIFIED DUPLICATE of bug 190737
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M4   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-05 10:35 EST by Benno Baumgartner CLA
Modified: 2009-12-08 03:38 EST (History)
3 users (show)

See Also:


Attachments

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