Solving the API encapsulation problem

Thanks to Java platform modules leveraging the encapsulation concepts of modularity, the platform now has the means to effectively protect internal classes from external usage. The platform can evolve to modify or even completely remove and replace the internal APIs, and still ensure backward compatibility as long as the public exported APIs remain the same. I believe this enables better and faster evolution of the Java platform, and we all get to benefit from it.

On the other hand, remember that there are some classes that were publicly accessible in earlier Java versions that are now encapsulated in Java platform modules. This implies that there are possibly some backward incompatibilities with applications that were formerly depending on those internal APIs (even though they really shouldn't)! This is a problem many of us will have to tackle when we migrate code written in Java 8 or earlier into Java 9. We'll learn more about that, as well as strategies to handle such situations in Chapter 10, Preparing Your Code for Java 9.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.181.57