7 Recurring challenges when running on Java 9

 

This chapter covers:

  • distinguishing standardized, supported, and internal JDK APIs
  • finding dependencies on JDK-internal APIs with JDeps
  • compiling and running code that depends on internal APIs
  • why a split package can make classes invisible
  • how to mend split packages

Chapter 6 discusses some problems that you might come up against when migrating your project to Java 9. Once you’re done with that, though, you are not going to encounter them ever again unless you pick up new dependencies that are outdated and not compatible with Java 9. This chapter explores two challenges where this is not true:

Navigation
  • Relying on internal APIs leads to compile errors (7.1). This is true for JDK-internal APIs, for example classes from sun.* packages, but also for code internal to the libraries or frameworks you depend on.
  • Splitting packages across artifacts causes compile and runtime errors (7.2). Again, this can happen between your code and JDK-modules as well as between any other two artifacts, for example your code and a third-party dependency.

7.1  Encapsulation of internal APIs

7.1.1  Internal APIs under the microscope

7.1.2  Analyzing dependencies with JDeps

7.1.3  Compiling against internal APIs

7.1.4  Executing against internal APIs

7.1.5  Compiler and JVM options for accessing internal APIs

7.2  Mending split packages

7.2.1  What is the problem with split packages?

7.2.2  The effects of split packages

7.2.3  Many ways to handle split packages

7.2.4  Patching modules—last resort to handling split packages

7.2.5  Finding split packages with JDeps

sitemap