Bug 133335

Summary: [compiler][null] Null checking gives errors where they don't matter, and inconsistently.
Product: [Eclipse Project] JDT Reporter: Ricky Clarkson <ricky_clarkson>
Component: CoreAssignee: Maxime Daniel <maxime_daniel>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: mlists
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Ricky Clarkson CLA 2006-03-27 06:08:30 EST
The following code compiles:

Object o=Math.random()<0.5 ? null : new Object();
System.out.println(""+o);

The following code doesn't:

Object o=Math.random()<0.5 ? null : new Object();

if (o==null)
{
}

System.out.println(""+o);

The null check complains that o might be null at the last line, which is just as possible as it was without the if statement.

Even so, it doesn't even matter that o might be null there, as String concatenation works happily with null values.
Comment 1 Maxime Daniel CLA 2006-03-27 08:38:00 EST

*** This bug has been marked as a duplicate of 127919 ***