Bug 201164 - [compiler] Default compiler settings are too strict
Summary: [compiler] Default compiler settings are too strict
Status: VERIFIED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-25 12:05 EDT by Randy Hudson CLA
Modified: 2007-09-18 05:31 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 Randy Hudson CLA 2007-08-25 12:05:12 EDT
Out of the box, Eclipse generates many compiler warnings that are not found when using javac.exe. For example, complaining about the usage of raw types. Just because List is now generic, doesn't mean that all references to it should be parameterized. In fact, it is often the case that collections contain Objects.

"Correcting" my code so that it reads:
   List<Object> list;
is about as useful as:
   String message = (String)"hello";

I think it's fine if Eclipse wants to support its own types of warnings, but the default settings should produce the same warnings as javac, such that code which compile clean outside of eclipse, compiles clean when imported into a new workspace.
Comment 1 Philipe Mulet CLA 2007-08-27 13:03:43 EDT
This warning got enabled after a poll was conducted on jdt-core-dev and newsgroup. Also it was referenced as bug 159456.

This very warning is to help migrating to generics, as opposed to only helping addressing the type safety issues. Unchecked warnings are only showing the secondary bad effects of using raw types. The raw type warning is more useful for detecting the origin of the problem. Also the spec clearly discourages from using raw types, and even mentioned these could be banned in the future.
Also note that List<Object> is not equivalent to the raw List.

Re: defaults matching javac. I disagree. 
Javac picks the warnings it finds relevant, and we do the same. Now, you can always turn off some annoying warnings if you need.
Comment 2 Philipe Mulet CLA 2007-08-27 13:04:37 EDT
No further action planned.
Comment 3 Randy Hudson CLA 2007-08-27 14:41:10 EDT
I just thought I would take a shot at suggesting "warning parity" with javac.  I can only assume that "error parity" with javac is a rule. In other words, JDT must not generate errors if javac does not generate errors.

As far as my example, List and List<Object> is like Integer vs. String. If I need a List<Object>, I should know that and I'll use it when necessary. Otherwise, I'll just use "List", because that's all I need, and it's easier to read.

Anyway, I understand the argument of being better/different than javac. However, my feeling on polls is that you generally get more input from the people who want things to change, and less from people who are happy the way things are (or don't even understand the question ;-).

thanks.
Comment 4 Philipe Mulet CLA 2007-08-28 05:05:56 EDT
I agree that polls are somewhat biased, but I just wanted to say that it got discussed a while ago in the open, before we enabled this warning by default.

Re: parity with javac
We usually try to match the language spec than javac. In case of discrepancies, this is more tricky (need to find out which is right/wrong). The spec describes error situations, and mandates only very few warnings (unchecked mostly).
Comment 5 David Audel CLA 2007-09-18 05:31:35 EDT
Verified for 3.4M2 using build I20070917-0010