Java 9, 10 , 11 - e l’ultimissimo 12 - sono arrivati in fretta e hanno portato cambiamenti profondi: nuove funzionalità, strumenti aggiuntivi e jvm. Gli aggiornamenti pubblici di Java 8 sono terminati a gennaio 2019 e questo è uno dei motivi principali che ci porta a guardare alla fase successiva.
Theodor Dumitrescu, Java Developer di ThinkOpen, mostra perché la portabilità di un progetto per l'utilizzo di JDK 9 (o superiori) non è immediata come in passato.
Viene dedicato un approfondimento specifico al passaggio da Oracle a Eclipse, una sfida non solo per gli sviluppatori ma anche per l'intera community. Infatti, tantissimi progetti hanno cambiato casa abbandonando la ben nota madre Oracle per essere accolti dalla comunità di Eclipse. Lo speaker illustra l’evoluzione dell'intero ecosistema e delle licenze che permettono di sfruttarlo.
13. #TOPWorkshop
Java 8 -12
0
1
2
3
4
5
6
7
01 - Recaptiluation
01 ● A new LTS release every three years
○ this does not mean three years of free updates
● From JDK 11, the Oracle JDK can only be used in production with a commercial
support contract
○ the only free JDK 11 and later will be OpenJDK binaries
● to receive free updates to the JDK you must update your JDK every six months
● JDK 8 and older are still available completely free
○ but from January, without security patches and bug fixes
○ you have to pay an license for them
17. #TOPWorkshop
Java 8 -12
0
1
2
3
4
5
6
7
02.2 JDK 9: the clean Up Starts
● deprecated APIs were removed for the first time
● redundant features eliminated
● significant command line changes
○ removed 187 --XX flags
02.2 - Onwards and compatibility
18. #TOPWorkshop
Java 8 -12
0
1
2
3
4
5
6
7
02.2
JDK 9: the clean Up Starts
● deprecated APIs were removed for the first time
○ six methods and one class
○ in JDK 11
■ Applets, Browser Plugin, Web Start, JavaFx
■ java.se.ee meta-module
● redundant features eliminated
● significant command line changes
○ removed 187 --XX flags
02.2 - Onwards and compatibility
19. #TOPWorkshop
Java 8 -12
0
1
2
3
4
5
6
7
02.2
“New versions of Java may include breaking changes” - Oracle
● anything for removal will be deprecated first
○ JEP 277 @Deprecated(forRemoval=true)
○ minimum of one release warning (just six months)
02.2 - Onwards and compatibility
31. #TOPWorkshop
Java 8 -12
0
1
2
3
4
5
6
7
03.2 - JEPs
03.2
● JEP 296: Consolidate JDK forests into single repo
● JEP 304: Garbage Collector Interface (Red Hat)
● JEP 307: Parallel Full GC for G1
● JEP 310: Application Class-Data Sharing
● JEP 312: Thread-Local Handshakes
● JEP 316: Heap allocation on alternative devices (Intel)
● JEP 317: Experimental Java-based JIT compiler (GraalVM)
● JEP 319: Root Certificates
32. #TOPWorkshop
Java 8 -12
0
1
2
3
4
5
6
7
03.3 - Docker awareness
03.3
● adhering to memory limits set in the container
● setting available cpus in the container
● setting cpu constraints in the container
● -XX:-UseContainerSupport
39. #TOPWorkshop
Java 8 -12
0
1
2
3
4
5
6
7
04.1.5 - JEP 330: Launch Single File
Source Code
04
● In JDK 10 Three modes for the Java launcher
○ Launch a class file
○ Launch the main class of a JAR file
○ Launch the main class of a module
● Since JDK 11
○ launch a class declared in a source file
■ $ java TopWorkshop.java arg1 argN
○ single file source code shebang
■ #!$JAVA_HOME/bin/java --source 11
■ $ ./TopWorkshop arg1 argN
40. #TOPWorkshop
Java 8 -12
0
1
2
3
4
5
6
7
04.1.6 - Other JEPs
● JEP 315: Improve Aarch64 intrinsics
● JEP 324: Ket Agreement with Curve25519 and Curve448
● JEP 329: ChaCha20 and Poly1305 Cryptographic Algorithms
● JEP 331: Low-Overhead HEap Profiling
● JEP 332: Transport Layer Security 1.3
● JEP 333: ZGC
● JEP 335: Deprecate the Nashorn JavaScript Engine
● JEP 336: Deprecate the Pack200 Tools and API
04
48. #TOPWorkshop
Java 8 -12
0
1
2
3
4
5
6
7
06.1 - Project Amber
● JEP 286 Local-Variable Type Inference (var) (JDK 10)
● JEP 301 Enhanced Enums
● JEP 305 Pattern Matching
● JEP 323 Local-Variable Syntax for Lambda Parameters (JDK 11)
● JEP 325 Switch Expressions (preview, JDK 12)
● JEP 326 Raw String Literals
● JEP 348 Java Compiler Intrinsics for JDK APIs
06.1
49. #TOPWorkshop
Java 8 -12
0
1
2
3
4
5
6
7
06.1 - Project Amber
final class Point {
public final int x;
public final int y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
// state-based implementations of
equals, hashCode, toString
// nothing else
record Point(int x, int y);
06.1
50. #TOPWorkshop
Java 8 -12
0
1
2
3
4
5
6
7
06.2 - Project Loom
“The goal of this Project is to explore and incubate Java VM features and APIs built
on top of them for the implementation of lightweight user-mode threads (fibers),
delimited continuations (of some form), and related features, such as explicit
tail-call.” - OpenJDK
06.2
52. #TOPWorkshop
Java 8 -12
0
1
2
3
4
5
6
7
06.3 - Project Panama
● native function calling from JVM (C, C++), specifically per JEP 191
○ jextract tool
● native data access from JVM or inside JVM heap
● new data layouts in JVM heap
● native metadata definition for JVM
● header file API extraction tools (see below)
● native library management APIs
● native-oriented interpreter and runtime “hooks”
● class and method resolution “hooks”
● native-oriented JIT optimizations
● tooling or wrapper interposition for safety
● exploratory work with difficult-to-integrate native libraries
06.3