Bug 35389 - Compiler settings can violate JLS [build path]
Summary: Compiler settings can violate JLS [build path]
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows NT
: P3 minor (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-20 13:08 EST by Jim Sculley CLA
Modified: 2003-11-20 06:54 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Sculley CLA 2003-03-20 13:08:18 EST
Treating unreachable code errors as warnings is a violation of the Java Language
Specification, per section 14.20.  From reading the JDT-Core-dev mailing list, I
know that the team is aware that such behavior violates the spec, but Eclipse
still allows it in the RC3 build.
Comment 1 Philipe Mulet CLA 2003-03-20 13:17:51 EST
All optional compiler settings are configurable. You may even get the compiler 
to report errors for things which do not matter at the spec level, like 
deprecation.

By default, unreachable code is an error. Now I agree there should be some 
clear indication that this violates the spec.
Comment 2 Philipe Mulet CLA 2003-03-20 13:18:58 EST
Actually do you have an example where when the setting is turned to ERROR, we 
still accept unreachable code ?
Comment 3 Jim Sculley CLA 2003-03-20 18:03:06 EST
No.  You interpreted my comments correctly.  The point of my bug report is that
setting it to be a warning/ignore should be disallowed (or as you said, a very
explicit indication of non-compliance), because the specification explicitly
states that under no circumstances should a compiler consider such code valid. 
If it were up to me, I'd remove the option entirely.
Comment 4 Philipe Mulet CLA 2003-03-21 04:55:30 EST
I am not disagreing with you. We kept the unreachable code setting for backward 
compatibility with VAJ. But now it is pretty much obsolete.

Should only remain settings which make our compiler stricter, not more 
permissive.

Still post 2.1
Comment 5 Philipe Mulet CLA 2003-03-26 08:57:37 EST
Unresolved imports also fall into the same category.
Comment 6 Philipe Mulet CLA 2003-04-02 06:34:22 EST
Reopen
Comment 7 Philipe Mulet CLA 2003-04-02 06:34:58 EST
UI should warn user if these settings are chosen.
Comment 8 Dirk Baeumer CLA 2003-04-02 08:06:41 EST
Since from the spec it is an error we shouldn't allow users to set the warning 
level to warnings. IMO we should remove it from the UI and should always treat 
it as an error.

Philippe, why do you think we have to keep this VAJ compatibility mode. 
Wouldn't it make more sense to remove it ?

Comment 9 Philipe Mulet CLA 2003-04-02 08:13:42 EST
I believe migration is still an issue (need to check). Also for backward 
compatibility reason, I don't think we can remove this support, though it would 
indeed be desirable.

John - can you please comment on the migration concerns ?
Comment 10 John Wiegand CLA 2003-04-02 10:54:31 EST
I am collecting additional feedback on the migration issue - more info later. 

My personal reaction: I don't find the unreachable code warning compelling.  
The unresolved import case doesn't justify an exception.  

Why we did this (my guess): If there is an error, then we only generate stubs 
for the method (or type for the import case).   By making these warnings, we 
enabled development/debugging while the "problem" existed.
Comment 11 Philipe Mulet CLA 2003-04-02 11:11:37 EST
Just to clarify: in case an import error is detected, only static methods and 
constructors are turned into problem methods. The rest is just fine (if not 
referencing these imports).

I can understand why it would be scary for some user to enable the compiler to 
be in a mode where we accept a superset of the language (exported source 
wouldn't compile with other compiler). Maybe, some clear indication that 
changing these settings is breaking the spec, is all we need if we still need 
to maintain the migration story alive.
Comment 12 Dirk Baeumer CLA 2003-05-08 06:12:39 EDT
John, do you have more information regarding the migration issue.
Comment 13 John Wiegand CLA 2003-05-08 11:11:49 EDT
The migration issue is not a show stopper.  There are two requirements: we need 
to (1) ensure that no code is lost during migration (for example, we cannot 
refuse to import the code if it had errors) and (2) help the user through the 
migration (we can do this by reporting the errors and allowing the user to fix 
them.  If there was a quick fix (?) it could be even better).  We should add 
this information to the 3.0 migration guide.
Comment 14 Martin Aeschlimann CLA 2003-07-22 08:46:29 EDT
The compiler preference page has been redesigned fro 3.0M2 according to
suggestions by Philippe. The two problematic options have been removed from the
UI. Veto if that is not what you want.

Philippe, I suggest you deprecate the preference constants and ignore if the
value (from an old workspace) still is set to ignore or warning.
Comment 15 Philipe Mulet CLA 2003-07-22 11:08:20 EDT
I agree.
Comment 16 Philipe Mulet CLA 2003-10-22 11:07:59 EDT
Invalid preferences are now ignored, thus the compiler cannot violate the specs 
any longer.

Fixed
Comment 17 Philipe Mulet CLA 2003-10-22 11:13:11 EDT
Fixed.
Comment 18 David Audel CLA 2003-11-20 06:54:33 EST
Verified