Bug 275446 - Missing "Type mismatch" annotation error message
Summary: Missing "Type mismatch" annotation error message
Status: VERIFIED NOT_ECLIPSE
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.6 M1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-08 08:00 EDT by T. Fischer CLA
Modified: 2009-08-03 07:05 EDT (History)
2 users (show)

See Also:


Attachments

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