In preparation for the planned July release of Java 9, Oracle has released guidance for moving applications over to the forthcoming upgrade, which features big changes through modularization.
The newly released JDK (Java Development Kit) 9 Migration Guide notes that every update brings with it binary, source, and behavioral incompatibilities with previous versions. "The modularization of the Java SE Platform brings many benefits but also many changes," Oracle said. "Code that uses only official Java SE Platform APIs and supported JDK-specific APIs should continue to work without change." But code that uses certain features or JDK-internal APIs may not run or may give different results, the company cautioned.
To prepare for the migration, Oracle suggests getting the early access build, running a program before recompiling, updating third-party libraries, compiling an application, and running the jdeps static analysis on code. When running their applications, developers are cautioned about unrecognized VM options from the JVM. Oracle also recommends looking at tests to make sure application behavior is the same as it was with JDK 8.
Compilation using the JDK 9 compiler might fail for a number of reasons, according to Oracle. Most of the internal APIs in the JDK are inaccessible by default, so developers might get errors at runtime --
IllegalAccessErrors -- indicating an application or libraries are dependent on internal APIs. The Java Dependency Analysis tool will identify dependencies. "You may see more deprecation warnings than previously," Oracle said. "If you see deprecation with removal warnings, you should address those soon."
With garbage collection, the G1 collector is slotted as the default collector on 32- and 64-bit server configurations. "Using a low-pause collector such as G1 should provide a better overall experience, for most users, than a throughput-oriented collector such as the Parallel GC, which was the previous default," said Oracle. "You should look at your VM parameters to see if anything should be adjusted."
JDK 9 removes JavaDB, which was a rebranding of the Apache Derby database, and the JVM TI hprof agent. This agent was written as demonstration code for the JVM Tool Interface and not intended to be a production tool. Useful features of the agent have been superseded by better tools in the JDK, Oracle said. Jhat, an unsupported, experimental heap visualization tool, was removed as well.
The Windows 32 VM client is dropped, with only a server VM offered. "JDK 8 and earlier releases offered a client JVM and a server JVM for Windows 32-bit systems with the default being the client JVM," Oracle said. "JDK 9 offers only the server JVM. The server JVM has better performance although it might require more resources. This helps to reduce complexity." Oracle also removed some Mac OS-specific features, including the AppleScript engine.
This story, "Oracle preps developers for Java 9 upgrade" was originally published by InfoWorld.