Bug 133335 - [compiler][null] Null checking gives errors where they don't matter, and inconsistently.
Summary: [compiler][null] Null checking gives errors where they don't matter, and inco...
Status: RESOLVED DUPLICATE of bug 127919
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Maxime Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-27 06:08 EST by Ricky Clarkson CLA
Modified: 2006-03-27 08:38 EST (History)
1 user (show)

See Also:


Attachments

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