Motivation
The Joy of Java 11 is finally upon us. Here’s why you should drop everything you’re doing and upgrade.
- Java 8 is going through its End of Public Updates process (Jan 2019)
- Java 11 is the next LTS release
- The accumulation of new features across the last 3 versions is substantial
- The move to shorter release schedule and the java module system represents a major shift in the ecosystem
- This shift will take a while to fully implement, so it’s preferable to start early
- Upgrading to Java 11 puts you on firm and stable ground while making sure you don’t stagnate
Features
Module System
Modularizing existing projects is not required but recommended.
- The JPMS is a fundamental change in how java programs are built and run
- Replaces the error-prone class-path with a module-path
- Provides strong encapsulation:
- Packages are now organized into modules
- Modules need to declare what they export and what they depend on
- The jdeps tool: used to detect dependencies between jars
- The unnamed module: bottom-up migration
- Automatically depends on all named modules
- Cannot be depended upon
- Automatic modules: top-down migration
- Allows modules to depend on un-modularized jars by treating them as automatic modules
- Two or more jars on the class-path can’t contain types in the same package
Resources