Java 9:Building Robust Modular Applications
上QQ阅读APP看书,第一时间看更新

Access to internal APIs

The Java 9 platform has encapsulated internal APIs to increase security of the platform and applications written in Java. Applications that you program in Java 9 will not have default access to the JDK's internal APIs, unlike with previous versions of the Java platform. Oracle has identified some internal APIs as critical; those APIs remain accessible via the jdk.unsupported JDK module.

The aforementioned critical APIs (internal to the JDK) are:

  • sun.misc
  • sun.misc.Unsafe
  • sun.reflect.Reflection
  • sun.reflect.ReflectionFactory.newConstrutorForSerialization

If you have pre-Java 9 applications that implement any sun.* or com.sun.* package, you will likely run into problems migrating your applications to Java 9. In order to address this issue, you should review your class files for use of sun.* and com.sun.* packages. Alternatively, you can use the Java dependency analysis tool, jdeps, to help determine if your Java program has any dependencies on JDK internal APIs.

The jdeps tool is the Java dependency analysis tool, that can be used to help determine if your Java program has any dependencies on JDK internal APIs.