Private APIs not usable in Java 9?

Chris Newland cnewland at chrisnewland.com
Thu Apr 9 12:37:17 UTC 2015


I just asked about this on the adoption-discuss at openjdk.java.net list and
the answer from Martijn Verburg is:

---
Hi Chris,

I think the strong advice for those using private APIs is to run the jdeps
tool to see where they are using APIs that will go away / be moved. I'd
then get them to post that list to jigsaw-dev, I guess the root cause of
some of these issues should also be logged in JBS and fixed :-).

Cheers,
Martijn
---

If you run $JAVA_HOME/bin/jdeps -jdkinternals <class dir or jar> then it
will show all uses of JDK private APIs that will go away in JDK9.

An example from one of my own projects:

chris at chris:~$ /home/chris/jdk1.8.0_40/bin/jdeps -jdkinternals
/home/chris/jitwatch/target/jitwatch-1.0.0-SNAPSHOT.jar
jitwatch-1.0.0-SNAPSHOT.jar -> /home/chris/jdk1.8.0_40/lib/tools.jar
   org.adoptopenjdk.jitwatch.loader.BytecodeLoader
(jitwatch-1.0.0-SNAPSHOT.jar)
      -> com.sun.tools.javap.JavapTask                      JDK internal
API (tools.jar)
      -> com.sun.tools.javap.JavapTask$BadArgs              JDK internal
API (tools.jar)

Warning: JDK internal APIs are unsupported and private to JDK
implementation that are
subject to be removed or changed incompatibly and could break your
application.
Please modify your code to eliminate dependency on any JDK internal APIs.
For the most recent update on JDK internal API replacements, please check:
https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool

I think sending these reports to jigsaw-dev at openjdk.java.net is a
worthwhile effort to help them direct resources for bug fixing and new
public APIs.

Cheers,

Chris





More information about the openjfx-dev mailing list