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.