JDK 9 Outreach (DRAFT)
Introduction
With JDK 9 development underway in the OpenJDK Community, and based on our experiences with open source projects testing against JDK 9 Early Access builds in the Quality Outreach effort, it seems like a good idea to compile the accumulated wisdom to make it easier for new projects to start testing against JDK 9.
Caveat Lector
JDK 9 has not been released yet. That means the tips and suggestions accumulated here should not be taken as the final word on how to adjust your code for JDK 9 as some things may (and probably will) change as the set of JEPs targeted for JDK 9 changes. If in doubt, ask - preferably on the adoption-discuss mailing list.
The Little Things
Before you get started testing your code against JDK 9, there are a few little things to consider.
JDK 9 Early Access Builds
You can build JDK 9 yourself by following the build instructions to build the OpenJDK source code in the jdk9/jdk9 forest. Please check the list of supported build platforms to verify that your build platform is supported before you attempt building JDK 9 from source yourself.
JDK 9 Early Access builds may also be provided by third parties. Oracle publishes regular JDK 9 builds at http://jdk9.java.net, for example.
Look for unrecognized VM options
If your application's startup script launches the JDK 9 JVM with an unrecognized VM option, it will exit and let you know that it couldn't create a VM because of that unrecognized VM option. Some of the VM flags that were deprecated in JDK 8, have been removed in JDK 9 - like those relating to the permanent generation, which was removed in JDK 8.
Run jdeps on your code
In JDK 8 a new Java Dependency Analysis Tool (jdeps) was added to help developers understand the static dependencies of their applications and libraries. It can help you find dependencies on any internal, unsupported or private APIs that your application or its libraries use. A program using such APIs is not guaranteed to work in future versions of JDK 9 or even the same platform. For more information, please see this document.
A jdeps plugin for Apache Maven exists.
For best results, please make sure to run jdeps from the most recent JDK 8 update release or JDK 9 Early Access build.
Testing Your Code
In general, it's simpler to start by building your code in your familiar build environment, and test it by running it on JDK 9, than to start by building it on JDK 9. The tools and libraries used in your build process might themselves not yet have been tested with JDK 9 by their developers.
JDK 9 changes that may affect your code
Some of the changes targeted for JDK 9 may affect code that relies on deprecated, removed, unsupported, internal or unspecified functionality. The list below has been compiled from the list of JEPs targeted for JDK 9 and other resources. It is not an exhaustive list of changes - there may be other changes you run into that have not been listed here.
Where available, the list provides links to further resources, like JEPs, mailing list threads or JBS issues.
Unified JVM Logging
JEP 158 may change log message formats and possibly the meaning of some JVM options.
Remove GC Combinations Deprecated in JDK 8
JEP 214 may affect code that relies on the removed GC combinations.
Users who are using any of the flags that are being removed will have to update their JVM-startup command lines. If they are moving from JDK 8 to JDK 9 then they will already have seen warning messages and thus should not be surprised. For a detailed list of the flags and flag combinations that have stopped working in JDK 9, please consult the JEP text.
Modular Run-Time Images
JEP 220 may affect code that relies on the removed endorsed-standards override mechanism, the removed extension mechanism, and the existence of rt.jar and tools.jar files as well as the old directory layout of files in the JDK & JRE installation image.
New Version-String Scheme
JEP 223 may affect code that relies on the old version string scheme to distinguish major, minor, and security-update releases.
Remove Launch-Time JRE Version Selection
JEP 231 may affect code that relies on the removed ability to request, at JRE launch time, a version of the JRE that is not the JRE being launched.
Remove the JVM TI hprof Agent
JEP 240 may affect code that relies on the removed hprof
agent library as part of the JDK.
Remove the jhat Tool
JEP 241 may affect code that relies on the removed experimental, unsupported, and out-of-date jhat tool.
Milling Project Coin
JEP 213 may affect source code that uses underscore ("_") as an identifier. Its use generated a warning as of Java SE 8, and has been turned into an error in JDK 9.
Simplified Doclet API
JEP 221 may affect code that uses the Doclet API. It replaces the Doclet API with a simpler design that leverages newer alternative APIs with improved functionality, and updates the standard doclet to use it.
New JDK 9 features
REPL (aka Project Kulla)
Project Kulla introduces a new REPL for Java 9. You can test this by following the instructions from the latest Adoption Group hackday.
Other potential changes to consider
There may be other changes worth considering to add to this page. If you have suggestions for items to add to this list, please send an e-mail to the adoption-discuss mailing list.