Bug 354922 - Compiler Compliance Level mismatch with the JDK Library
Summary: Compiler Compliance Level mismatch with the JDK Library
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.8 M2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-17 05:17 EDT by Girish CLA
Modified: 2011-09-13 07:05 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 Girish CLA 2011-08-17 05:17:09 EDT
Build Identifier: 

I am working on a eclipse project for which default build project library is 1.5 but compliance level is 1.4.

From above configuration what I understood is that the project will be build with 1.4 compatibility and build the same way as that of JDK 1.4 library.

In my program I am using java.util.concurrent.CopyOnWriteArraySet which was introduced in jdk  1.5.  When I compile my code with above setting it gets compiled properly.
 But when I  point my default workspace library to 1.4 with compliance level as 1.4 it shows error for the same.

What is the difference between setting the build library JRE and compiler compliance 
 
Thanks,
Girish


Reproducible: Always
Comment 1 Girish CLA 2011-08-17 05:17:22 EDT
I am working on a eclipse project for which default build project library is 1.5 but compliance level is 1.4.

From above configuration what I understood is that the project will be build with 1.4 compatibility and build the same way as that of JDK 1.4 library.

In my program I am using java.util.concurrent.CopyOnWriteArraySet which was introduced in jdk  1.5.  When I compile my code with above setting it gets compiled properly.
 But when I  point my default workspace library to 1.4 with compliance level as 1.4 it shows error for the same.

What is the difference between setting the build library JRE and compiler compliance 
 
Thanks,
Girish
Comment 2 Ayushman Jain CLA 2011-08-18 04:10:39 EDT
This is not a bug. Please use the JDT forum (http://www.eclipse.org/forums/index.php/f/13/ )to ask questions.

The compliance level generates code compliant with a certain Java version that you can run using a JRE of that version. While the JRE library you use for your project is where all Java classes are picked up from.

In your case, using 1.5 JRE and 1.4 compliance meant that you could use J2SE 5 APIs but the generated code can be run using a 1.4 JRE. However, when you changed the 1.5 JRE to 1.4 JRE, the API java.util.concurrent.CopyOnWriteArraySet could no longer be found in the JRE and hence you will get an error.

HTH
Comment 3 Olivier Thomann CLA 2011-08-18 08:00:07 EDT
You can also convert your java projects to be bundles and use API Tools to detect wrong API being used according to the EE set for the bundle.
Comment 4 Satyam Kandula CLA 2011-09-13 07:05:23 EDT
Verified for 3.8M2