7 Recurring challenges when running on Java 9 or later

 

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
  • Mending split packages

Chapter 6 discusses some problems you may come up against when migrating a project to Java 9+. Once you’re done with that, though, you aren’t going to encounter those issues again unless you pick up pre-Java 9 dependencies. This chapter explores two challenges you might still need to deal with:

  • Relying on internal APIs leads to compile errors (section 7.1). This is true for JDK-internal APIs, such as classes from sun.* packages, but also for code internal to the libraries or frameworks you depend on.
  • Splitting packages across artifacts causes compile-time and run-time errors (section 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’s 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 for handling split packages

7.2.5 Finding split packages with JDeps

7.2.6 A note on dependency version conflicts

Summary

sitemap