class: center, middle .vcenter[ # Java 9 ## A very brief preview ] --- class: center, middle .vcenter[ # April 14, 2015 # September 22, 2016 # September 22, 2017 ] --- class: center, middle .vcenter[ # Project Jigsaw ## The big feature in Java 9 ] --- class: center .jigsaw1-image[ ![Before](images/jigsaw1.png) ] .copyright[ Copyright © 2015, Oracle and/or its affiliates. All rights reserved. ] --- class: center .jigsaw2-image[ ![Before](images/jigsaw2.png) ] .copyright[ Copyright © 2015, Oracle and/or its affiliates. All rights reserved. ] --- class: center .jigsaw2-image[ ![Before](images/jigsaw3.png) ] .copyright[ Copyright © 2015, Oracle and/or its affiliates. All rights reserved. ] --- .left-column[ ## Modules are
for everyone! ] .right-column[ Very simple module-info.java ``` module org.example @ 1.0 { requires jdk.base; requires com.google.guava @ 18.0; exports org.example.api; } ``` ] -- .right-column-incremental[ ``` module org.example @ 1.0 { requires jdk.base; requires com.google.guava @ 18.0; exports org.example.api; * exports com.google.common; } ``` ] --- .left-column[ ##
jshell, aka
the Java REPL ] .right-column[ ```bash | Welcome to JShell -- Version 0.508 | Type /help for help -> System.out.println("Hello world!") Hello world! -> ``` ] -- .right-column-incremental[ ```bash -> (int) (Integer.MAX_VALUE + 1) | Expression value is: -2147483648 | assigned to temporary variable $1 of type int ``` ] -- .right-column-incremental[ ```bash -> (long) (Integer.MAX_VALUE + 1) | Expression value is: -2147483648 | assigned to temporary variable $2 of type long ``` ] -- .right-column-incremental[ ```bash -> (long) (Integer.MAX_VALUE + 1L) | Expression value is: 2147483648 | assigned to temporary variable $3 of type long ``` ] --- .left-column[ ## Compile for Older Platform Versions ] .right-column[ ``` class PrintTheArgs { public static void main(String... args) { System.out.println(String.join(", ", args)); } } ``` ```bash javac -source 1.6 -target 1.6 Test.java ``` ] --- .left-column[ ## New
Version-String Scheme ] .right-column[ Current scheme .incremental-bullets[ * Minor releases containing changes beyond security fixes are multiples of 20 * Security releases based on the previous minor release are odd numbers incremented by five, or by six if necessary in order to keep the update number odd ] ] -- .right-column-incremental[.incremental-bullets[ * e.g. 1.8.0, 1.8.0_5, 1.8.0_11, 1.8.0_20, 1.8.0_25, 1.8.0_31, 1.8.0_40, 1.8.0_45 ]] -- .right-column[
JDK 9+ scheme: MAJOR.MINOR.SECURITY
] -- .right-column-incremental[.incremental-bullets[.narrow-bullets[ * 1.8.0 ⇒ 8.0.0 ]]] -- .right-column-incremental[.incremental-bullets[.narrow-bullets[ * 1.8.0_05 ⇒ 8.0.1 ]]] -- .right-column-incremental[.incremental-bullets[.narrow-bullets[ * 1.8.0_11 ⇒ 8.0.2 ]]] -- .right-column-incremental[.incremental-bullets[.narrow-bullets[ * 1.8.0_20 ⇒ 8.1.2 ]]] -- .right-column-incremental[.incremental-bullets[.narrow-bullets[ * 1.8.0_25 ⇒ 8.1.3 ]]] -- .right-column-incremental[.incremental-bullets[.narrow-bullets[ * 1.8.0_31 ⇒ 8.1.4 ]]] -- .right-column-incremental[.incremental-bullets[.narrow-bullets[ * 1.8.0_40 ⇒ 8.2.4 ]]] -- .right-column-incremental[.incremental-bullets[.narrow-bullets[ * 1.8.0_45 ⇒ 8.2.5 ]]] --- .left-column[ ## More Polyglot! ] .right-column[ Parser API for Nashorn Java-Level JVM Compiler Interface ] --- .left-column[ ## Java 10? ] .right-column[ Value Types * "Codes like a class, works like an int!" * Navigate array of value types very fast * Also see http://objectlayout.org * Other optimizations become possible * Java 8's Optional
⇒ Value Type * Iterators without memory allocation * See http://www.infoq.com/presentations/java-9-10 ] -- .right-column-incremental[ Generic Specialization * E.g. List<int> * Related to Value Types ]