Bug 322209

Summary: "assert" triggers a warning about null when it shouldn't
Product: [Eclipse Project] JDT Reporter: Dominik Stadler <dominik.stadler>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: srikanth_sankaran
Version: 3.7   
Target Milestone: 3.6 M6   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Dominik Stadler CLA 2010-08-10 05:41:20 EDT
Build Identifier: 3.6.0

The following piece of code reports a warning about null-access because it thinks "assert" always does the null-check. However if the code is run without "-ea" the null-check will be necessary.

	public void testNullWarning(String param) {
		assert param != null;

		if (param == null) {
			System.out.println(param);
		}
	}


Reproducible: Always
Comment 1 Ayushman Jain CLA 2010-08-10 05:55:17 EDT
This is intended behaviour and we dont want to change this. See also bug 198044 for detailed discussions on the same.

*** This bug has been marked as a duplicate of bug 173725 ***
Comment 2 Srikanth Sankaran CLA 2010-08-26 03:21:11 EDT
Verified for 3.6.1 RC2
Comment 3 Srikanth Sankaran CLA 2010-09-14 00:32:48 EDT
Verified for 3.7 M2