Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336237 - Java Compiler using JDK 6.0 and compliance to 1.4 does not see the incompatible java.util.Arrays methods
Summary: Java Compiler using JDK 6.0 and compliance to 1.4 does not see the incompatib...
Status: CLOSED DUPLICATE of bug 256034
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-03 10:01 EST by Dervillo CLA
Modified: 2011-02-09 14:23 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dervillo CLA 2011-02-03 10:01:17 EST
Build Identifier: 3.6.1

While using JDK 6.0 but with compliance to 1.4, the Eclipse IDE did not alert me that the Arrays.copyOf(...) and Arrays.toString(...) methods were not compatible to JDK 1.4 version. The problem was only verified when deploying on the environment that was using JDK 1.4.

Reproducible: Always

Steps to Reproduce:
1.Set the project JSDK to 6.0
2.Set the Java Compiler compliance to JDK 1.4
3.Use the java.util.Arrays.toString(byte[]) or java.util.Arrays.copyOf(byte[], length) methods. (without error even it is not JDK 1.4 compliance.
Comment 1 Walter Harley CLA 2011-02-03 14:35:44 EST
The Arrays methods are part of the JRE, not part of the language.  In addition to setting the compiler compliance to 1.4, you also need to specify a 1.4 JRE.  Did you do that?
Comment 2 Olivier Thomann CLA 2011-02-03 15:22:59 EST
The compiler doesn't detect that as it takes whatever is available on the classpath. So if you really want to be compliant with 1.4, simply set 1.4 libraries on the classpath.
Now from within eclipse, you can convert your java project to be a PDE project and then set it to use API Tools.
API tools has all what you need to detect these wrong usages.
See the following blog entry:
http://olivier-eclipse.blogspot.com/2010/11/workspace-settings-vs-project-settings.html
Comment 3 Olivier Thomann CLA 2011-02-09 14:23:54 EST

*** This bug has been marked as a duplicate of bug 256034 ***