Bug 278016 - When compiler compliance level is less than the actual JRE, APIs not available in the level shall be reported as errors
Summary: When compiler compliance level is less than the actual JRE, APIs not availabl...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.1   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 222662 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-05-27 06:02 EDT by Jakub Holy CLA
Modified: 2010-11-03 00:51 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Holy CLA 2009-05-27 06:02:32 EDT
Currently if I set compliance level to 1.4 while my default JRE is 1.6 then I get a small and easy to overlook notice in the preference window that I should also change the project's JRE accordingly. If I overlook/forget it, I'll get no further warning when I'll use an API that is not available in 1.4, for example new java.sql.SQLException(String, Throwable) (since 1.6). This may have serious consequences because when I deploy it to the target environment I'll start getting TargetInvocationException: no such method etc. (Really, I did this foolish thing already twice.)

There should be only one place where you set the target JRE for a project. Currently, if I want to develop for an older JRE than the default one, I have to set the project's compiler compliance level and change the JRE on the project path to match the target one. The 2nd step is a burden because I even may not have that JRE installed. I should be well able to develop application for J2SE 1.4 using 1.5 or 1.6 JRE.

One one hand Eclipse did enough by telling me that I should change the project's JRE on the other hand if there is a possibility to make a mistake, it will be made, i.e. Eclipse should be fool-proof. 

Best regards, Jakub
Comment 1 Olivier Thomann CLA 2009-05-27 08:29:00 EDT
You could set up API Tooling for your bundle.
It does the detection of invalid library usage according to the EE set up for the bundle.
Comment 2 Srikanth Sankaran CLA 2010-11-03 00:51:13 EDT
*** Bug 222662 has been marked as a duplicate of this bug. ***