Java 9 modules
- Classpath




- November 6, 2015
- What Do WebLogic, WebSphere, JBoss, Jenkins, OpenNMS, and Your Application Have in Common? This Vulnerability.
- By @breenmachine

rt.jar : 65 MB
- Java 9 Module System
- Reliability
- Security
- Size
Modular JDK
Modular JDK
Modular JDK
Modular JDK
Deprecated JDK modules
Non-standard JDK modules
- Internal modules
Deprecated JDK modules
- … back to Java EE
Non-standard JDK modules
- Deleted classes
- Hidden packages
Module descriptor
Build module
Run module
Modular application
Modular application
Module descriptor
Export package
Multi-modules layout
Multi-modules layout
- 1 project = n modules
Create module
The Jigsaw Sandwich
The Jigsaw Sandwich
Encapsulation
Visibility
Visibility
Visibility
Split package
Regular export
Restricted export
sun.misc.Unsafe
New internal unsafe API (hidden) |
Keep sun.misc in 9, remove features when public replacement APIs exist |
Deep reflection

Deep reflection
- Open a package
- Open all the packages of the module
Module dependency
Transitive dependency
Transitive dependency
Static dependency
- Compile time only
Plain old jar
Plain old jar
Plain old jar
- No dependency to classpath
Plain old jar
Automatic Module
Automatic Module
- Plain old jar in module-path
Mixed mode
Mixed mode
Running on Java 9
- Compiling in Java 8
Big kill switch
- --illegal-access=permit
--illegal-access
- permit
- default in Java 9
- warn
- debug
- deny
- default in Java 10+
Command line java / javac
- Add root module
- --add-modules
Command line java / javac
jdeps
- Diagnostic tool
- since Java 8
- jdeps --jdk-internals
Going Native
jlink
- Custom runtime image
- Specific for a platform
- For small devices or in the cloud
jlink
- Custom runtime image
Ahead Of Time compilation
- Module ⇒ shared library
experimental feature ! |
Ahead Of Time compilation
- Run in AOT mode
experimental feature ! |
Benchmarks
Benchmarks
Conclusion
Jigsaw Goals
- Reliable configuration
- No classpath anymore
- compile time / runtime fidelity
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Jigsaw Goals
- Scale down the platform
- downsized unit of re-use
Jigsaw Goals
- Strong encapsulation
- Separate public types from implementation
- Enhanced security
Jigsaw Goals
- Closed World
- Ahead of time optimizations
Jigsaw Goals
- Reliable configuration
- Scale down the platform
- Strong encapsulation
Planning

Planning
- Public Review Ballot (2017-05-08)

Planning
- Public Review Ballot (2017-06-26)

Planning
- Feature Release

Release
- Java 9
- 2017/09/21, Feature release
- Java 10
- 2018/03/20, Feature release
- Java 11
- 2018/03, Long-Term Support release
?
Références
- OpenJDK 9
- Download (Linux) : http://jdk.java.net/9/
- Other plateforms : https://adoptopenjdk.net/
Références
- Oracle JDK 9
- Download : http://www.oracle.com/technetwork/java/javase/
- Documentation : http://docs.oracle.com/javase/9/
Références
- Download OpenJDK 10 Early Access
Références
- JavaOne, DevoxxBE talks (2015, 2016)