Bug 292095 - No way to enter file-specific compiler settings
Summary: No way to enter file-specific compiler settings
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-13 00:28 EDT by Alexei Svitkine CLA
Modified: 2009-10-14 21:25 EDT (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 Alexei Svitkine CLA 2009-10-13 00:28:34 EDT
Eclipse needs a way to specify class-specific Java compile settings.

For example, a project may wish to remain compatible with Java 5, but use some new Java 6-specific code. This could be done by moving Java 6 functionality to a separate class and only using that class conditionally if running on Java 6.

However, this is hard to do with Eclipse. It is not possible to set specific per-file compiler settings. Either you need to set compiler settings for the whole project to be Java 6 - which would risk you accidently using Java 6 features elsewhere without realizing it (without the compiler giving you an error) - or you have to resort to hacks ... such as configuring your external build system to add that class in - without it being in Eclipse, or to do everything through reflection (which is impractical for non-trivial things - and sometimes impossible - such as extending new Java 6 classes).

However, if per-file Java compiler settings could be added, it would make such a setup not only possible, but very convenient and powerful.