Community
Participate
Working Groups
Build ID: I20090430-2300 Steps To Reproduce: 1. Set you JDK Compliance to 1.5 in the preferences 2. Verify it in the project properties for a Plugin Project 3. Set the "Installed JREs" to a Java 1.6 JRE only in the preferences (no other JREs should be available) 4. In the project, create a class and type "new String().isEmpty();". This should be flagged as non-compliant with Java 1.5, but won't be as it compiles with Java 1.6. More information: I'm not sure if the project must be a plugin project or not. I'm not sure if this works with other compliance levels and JRE combinations. I'm not sure if it works with other JREs installed, but not set to default.
The compiler is using what is available on the classpath. There is no validation of method, types, fields to check if they match the corresponding compliance. If you want that check to be done, you can set up your bundle to use API Tooling and active the library usage compatibility.
(In reply to comment #1) > The compiler is using what is available on the classpath. There is no > validation of method, types, fields to check if they match the corresponding > compliance. > If that is the case, then what is the JDK Compliance preference for?
JDK compliance indicates how the compiler is behaving. Compliance 1.3 means that the eclipse compiler behaves (name lookup, declaring class for method invocations, ...) like javac 1.3. Compliance 1.4 => behaves like javac 1.4, ... In term of library usage, the eclipse compiler is using the libraries on the classpath. In your case you explicitly set the library to be 1.6 libraries even if the compliance is 1.5. Closing as INVALID as this is working as designed.
Verified for 3.5RC2 using I20090521-2000.