This presentation, inspired by the Lord of the Rings trilogy, depicts one of the most anticipated features of the JDK 9: Project Jigsaw.
It covers the following topics: Architecture; Accessibility; Modularisation; Implied Readability; Restricted Readability; Fat JARs; and Java Images.
Al the source code, inclusive a extensive documentation, can be found here: https://github.com/ekholabs/postcode-modules
3. JIGSAW
ARCHITECTURE
▸ Aragorn: The Beacons of Minas
Tirith! The Beacons are lit! Gondor
calls for aid.
▸ Theoden: And Rohan will answer.
Muster the Rohirrim. Assemble the
army at Dunharrow. As many men
as can be found. You have two days.
On the third, we ride for Gondor
and war.
▸ The Lord of the Rings: The
Return of the King.
4. JIGSAW
ARCHITECTURE
▸ A module definition file, named
as module-info.java, contains:
▸ Its name;
▸ The packages it makes
available publicly;
▸ The modules it depends on;
▸ Any services it consumes; and
▸ Any implementation for the
service it provides.
7. JIGSAW
ACCESSIBILITY
▸ The way is shut. It was made by
those who are Dead. And the Dead
keep it. The way is shut.
▸ The Lord of the Rings: The Two
Towers.
8. JIGSAW
ACCESSIBILITY
▸ An exported packaged is publicly
available to any module, except
when the exporting module
declares to which that package is
exported to.
▸ Packages can be transitive,
meaning that if module B requires
transitive module A and module C
requires transitive module B, then
C also contains A.
9. JIGSAW
MODULARISATION
▸ One ring to rule them all, one
ring to find them, One ring to
bring them all and in the darkness
bind them.
▸ The Lord o the Rings: The
Fellowship of the Ring.
10.
11. JIGSAW
IMPLIED READABILITY
▸ Speak, friend, and enter.
▸ Written at the Doors of Durin,
Moria.
▸ The Lord of the Rings: The
Fellowship of the Ring.
13. JIGSAW
RESTRICTED READABILITY
▸ I am a servant of the Secret Fire,
wielder of the flame of Anor. You
cannot pass. The dark fire will not
avail you, flame of Udûn. Go back
to the Shadow! You shall not pass!
▸ The Lord of the Rings: The
Fellowship of the Ring.
15. JIGSAW
FAT JARS
▸ That still only counts as one!
▸ Gimli says to Legolas during the
Battle of the Pelennor Fields.
▸ The Lord of the Rings: The
Return of the King.
16. JIGSAW
FAT JARS
▸ Use automatic-modules as
dependencies by adding them to
the module path:
▸ javac —module-path jars …
▸ Find out what the JAR
dependencies through the jdeps
tool:
▸ jdeps --generate-module-info .
jars/gson-2.8.1.jar
17. JIGSAW
JAVA IMAGES
▸ In place of a Dark Lord, you would
have a queen! Not dark, but
beautiful and terrible as the dawn!
Treacherous as the sea! Stronger
than the foundations of the earth!
All shall love me, and despair!
▸ Galadriel says when offered to
keep the One Ring.
▸ The Lord of the Rings: The
Fellowship of the Ring.
18. JIGSAW
JAVA IMAGES
▸ The Linker
▸ jlink is the linker tool and can be
used to link a set of modules,
along with their transitive
dependences, to create a
custom modular run-time
image.
19. JIGSAW
REFERENCES & SOURCE CODE
▸ Java Language Specification: Java SE 9
▸ https://www.jcp.org/en/jsr/detail?id=376
▸ http://openjdk.java.net/projects/jigsaw/spec/sotms/
▸ https://github.com/ekholabs/postcode-modules