Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Java 9 Readiness"
m |
|||
Line 8: | Line 8: | ||
=== Configure Eclipse for Java 9 === | === Configure Eclipse for Java 9 === | ||
− | + | See https://wiki.eclipse.org/Configure_Eclipse_for_Java_9 for details on configuration. | |
− | + | === Install Eclipse Java 9 Support (BETA) === | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
This is useful if you have to debug problems, e.g. when it fails to run your project. | This is useful if you have to debug problems, e.g. when it fails to run your project. | ||
Revision as of 05:34, 2 June 2017
This wiki page explains how projects can check whether they are ready for Java 9 and documents the state for each release train project. The page also indicates which projects will provide new support for Java 9, e.g. Eclipse JDT. Those projects are expected to contribute to what we will offer once Java 9 goes GA. Note that at this point, the Planning Council did not yet decide how to do that.
The biggest feature in Java 9 is the Java Platform Module System, a.k.a. Jigsaw. With this, access to internal code of the Java runtime will no longer work. The Planning Council requests every release train project to check whether they use internal code from the Java runtime, or whether they use a library (most likely from Orbit), that does so.
Java 9 uses *.jmod to package libraries as modules. The Java 8 version of JDT can't handle modules and so can't recognize a Java 9 JRE/JDK. Unfortunately licensing issues prevent JDT distributing Java 9 support until Java 9 GA. Consequently use of Java 9 prior to GA is not as trivial as one might expect.
There are several things you can do to check the readiness for Java 9.
Contents
Configure Eclipse for Java 9
See https://wiki.eclipse.org/Configure_Eclipse_for_Java_9 for details on configuration.
Install Eclipse Java 9 Support (BETA)
This is useful if you have to debug problems, e.g. when it fails to run your project.
This is essential if you want to run JUnit tests in the Eclipse IDE using Java 9.
We recommend to install the support via https://marketplace.eclipse.org/content/java-9-support-beta-oxygen/ because it is crucial that the Eclipse install, the Java 9 VM and the patch match. If you are not using an EPP with a pre-installed Marketplace Client, you must install it first (from the General Purpose Tools category of the http://download.eclipse.org/releases/oxygen P2 repo).
Another way to install it is to use Ed's Oomph based installer described here: https://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg14178.html.
Specify a Java 9 JRE
Use Window->Preferences->Java->Install JREs to make your Java 9 VM available within Eclipse.
You may want to associate Java 9 with some Execution Environments to force a rebuild using Java 9.
Run your tests with Java 9
You can do this locally or soon on Hudson. A Java 9 VM will hopefully be available on Hudson soon (bug 513618). To launch tests or self-hosted applications locally from your IDE with a Java 9 JRE, you need to install the Java 9 BETA support to configure an Installed JRE that points at a Java 9 JRE or JDK.
For JUnit (standalone) tests, you should specify a Java 9 execution environment on the JRE launch configuration tab.
For JUnit Plugin tests, you should specify a Java 9 execution environment on the Main launch configuration tab and as noted above, you must add "--add-modules=java.se.ee" to the VM arguments on the Arguments tab..
Check whether your project or required libraries use internals of the Java VM
Since Java 8 there is a tool that allows you to check whether you use internals of the Java VM. It is called jdeps(.exe)
. There are two ways you can check your code / repository:
- There is an Apache Maven JDeps Plugin (https://maven.apache.org/plugins/maven-jdeps-plugin/)
- The Eclipse Platform project has created a script (https://git.eclipse.org/c/platform/eclipse.platform.releng.aggregator.git/plain/production/reports/jdepsReport.sh) that calls jdeps during the build and generates a report. I suggest to use that approach. Please contact Sravan Lakkimsetti if you have any problems with this script.
NOTE:
1) We made an initial scan of the Oxygen (4.7) M5 release train repository and most of the violations are in third-party code. You have to work with the providers of the libraries to get this fixed or find an alternative approach.
2) https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool lists alternatives that can be used instead of the internal code. You can see in this list that there's not a replacement for every issue, e.g. sun.misc.Unsafe has no replacement and continues to work, at least for now.
Reflection hacks
Unfortunately jdeps does not detect access to internals made via reflection. You have to check your code for such cases and fix them.
Java 9 Readiness
If a release train project is not listed here, it means it has not been checked yet, and you have to assume it won't run on Java 9. If something does not work, it should be covered by a bug report.
Project | Contact | Runs on Java 9 | Adds Java 9 Support |
---|---|---|---|
Eclipse Project (Platform, JDT, PDE) | Dani Megert | Yes, but the module java.se.ee needs to be added and we have an open issue with some Platform UI tests due to org.objenesis (bug 508734). | Yes, new code to support Java 9 development, compilation, and debugging will be delivered. |
Web Tools Platform (WTP) | Carl Anderson | Not yet tested | Yes, new code to support Java 9 facets will be delivered |
EclEmma | Evgeny Mandrikov | Yes | Yes, ability to measure code coverage by tests that are executed on Java 9 will be delivered. |
Code Recommenders | Andreas Sewe | Yes @ M7 ( |
Yes (will work with Java 9 source) |
Automated Error Reporting | Andreas Sewe | Yes | n/a |
Object Constraint Language (OCL) | Ed Willink | Yes @ M7. | n/a |
Declarative QVT (QVTd) | Ed Willink | Yes @ M7. | n/a |
Eclipse for Testers | Marvin Mueller | No / Yes if using "--permit-illegal-access" | Not planned yet. |
Known state of Orbit Bundles.
Bundle | Version | Runs on Java 9 | Supports Java 9 |
---|---|---|---|
com.google.guava | 15.0.0 | Yes. All uses of sun.misc.Unsafe have a safe fallback.
|
n/a |
org.objectweb.asm | 5.2.0 | Yes | No. The ClassReader throws an IAE for greater than Opcodes.V1_8.
Workaround: in JaCoCo - see https://github.com/jacoco/jacoco/blob/v0.7.9/org.jacoco.core/src/org/jacoco/core/internal/Java9Support.java#L101 This is safe, because Java 9 does not introduce any new instructions. Version can be restored after bytecode generation/modification - see https://github.com/jacoco/jacoco/blob/v0.7.9/org.jacoco.core/src/org/jacoco/core/internal/Java9Support.java#L112 |
org.apache.felix.gogo.runtime | 0.10.0 | bug 514939 | n/a |
. | . | . |