Bug 275446

Summary: Missing "Type mismatch" annotation error message
Product: [Eclipse Project] JDT Reporter: T. Fischer <bugs.eclipse>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED NOT_ECLIPSE QA Contact:
Severity: minor    
Priority: P3 CC: Olivier_Thomann, srikanth_sankaran
Version: 3.4.2   
Target Milestone: 3.6 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description T. Fischer CLA 2009-05-08 08:00:26 EDT
Build ID: M20090211-1700 (3.4.2)

Steps To Reproduce: Use the following Java source code example:

  int missingMsg = (true == false) ? 0 : null;

  missingMsg = (true == false) ? null : 0;

  int workingMsg = (true == false) ? null : null;

Only the last line shows the correct annotation error: "Type mismatch: cannot convert from null to int"
Comment 1 Olivier Thomann CLA 2009-05-08 08:33:18 EDT
This is consistent with what javac is doing.
Comment 2 T. Fischer CLA 2009-05-18 11:49:52 EDT
What is comment 1 supposed to mean?
a) Null pointer exceptions at runtime are the way to go
b) NPEs do not happen often enough, this might bring them more fame
c) Eclipse JDT cannot do better than javac
d) javac is perfect, do no more
e) relocate the bug to the javac-development team
f) ???

Sorry, if I am missing formality (just wrote down my thoughts ;o)

Surely there is a notion I am not aware of, please explain.
Comment 3 Kent Johnson CLA 2009-05-19 10:33:45 EDT
The answer is c & e

We cannot report an error case that is NOT in the spec.

If the spec is changed, then we would make change.
Comment 4 Kent Johnson CLA 2009-06-19 11:55:40 EDT
Closing since this is a spec issue
Comment 5 Srikanth Sankaran CLA 2009-08-03 07:05:24 EDT
Verified for 3.6M1