SlideShare a Scribd company logo
© Copyright Azul Systems 2019
© Copyright Azul Systems 2015
@giltene
Keeping Up with Java:
Look at All These New Features!
Gil Tene
CTO, Azul Systems
1
© Copyright Azul Systems 2019
© Copyright Azul Systems 2015
@giltene
From JDK 9 To 13
And Beyond
Gil Tene
CTO, Azul Systems
2
© Copyright Azul Systems 2019
© Copyright Azul Systems 2015
@giltene
Java
After 8
Gil Tene
3
© Copyright Azul Systems 2019
© Copyright Azul Systems 2015
@giltene
Java
After 8
Gil Tene
CTO, Azul Systems
4
© Copyright Azul Systems 2019
Changes…
 Java 6 2006 (December)
 Java 7 2011 (July)
 Java 8 2014 (March)
 Java 9 2017 (September)
 Java 10 2018 (18.3)
 Java 11 2018 (18.9)
 Java 12 2019 (19.3)
 Java 13 2019 (19.9)
 Java 14 2020 (20.3) …
5
© Copyright Azul Systems 2019
Java version timeline
6
© Copyright Azul Systems 2019
Coming up to speed
 “Current” Java is 13, or 11
– Depending on who you talk to
 Consider changes from your “current” version
 For most of you, that’s Java 8
 So need to go over Java 9, 10, 11, 12, 13,…
7
© Copyright Azul Systems 2019
Changes…
 Java the language (“Java 13”)
– the syntax, the meaning
 Java SE the platform (“Java 13”, “JDK 13”, “Java SE 13”)
– specified APIs, packages, behaviour
 OpenJDK: an implementation (“OpenJDK 13”)
– under the hood stuff
– garbage collectors, CDS, …
8
© Copyright Azul Systems 2019
JDK 9: Big And Small Changes
9
© Copyright Azul Systems 2019
Java Platform Module System (JPMS)
 The core Java libraries are now a set of modules (JEP 220)
– 75 OpenJDK modules:
 24 Java SE
 2 aggregator modules
 1 smartcard (???)
 48 JDK
 Most internal APIs now encapsulated (JEP 260)
– sun.misc.Unsafe
– Some can be used with command line options
10
© Copyright Azul Systems 2019
jlink: The Java Linker (JEP 282)
$ jlink --module-path $JDKMODS:$MYMODS 
--addmods com.azul.zapp –-output myimage
$ myimage/bin/java –-list-modules
java.base@9
java.logging@9
java.sql@9
java.xml@9
com.azul.zapp@1.0
com.azul.zoop@1.0
com.azul.zeta@1.0
myimage
…confbin
jlink
lib
© Copyright Azul Systems 2019
JDK 9: The Clean Up Starts
 JDK 9 was a significant change for Java
– Deprecated APIs were removed for the first time
 Six methods and one class
 JDK 10 removed 1 package, 6 classes, 9 methods and 1 field
– Parts of the platform were removed for the first time
 The entire java.se.ee aggregator module was “hidden” in JDK 9
 And completely removed in JDK 11
 JDK 10, 11, 12, 13, 14… continue this work
 More features will be removed in the future
 CMS GC, Nashorn and Pack200 all deprecated. Others?
12
© Copyright Azul Systems 2019
JDK 9 Onwards And Compatibility
13
"Clean applications that just depend on java.se
should just work" - Oracle
• Note careful spelling of “java.se”
• ”java.se” refers to an aggregator module in JDK 9+
• Java SE 8 parts are absolutely being removed
© Copyright Azul Systems 2019
Platform parts removed
– The java.se.ee aggregator-module
 java.corba
 java.transaction
 java.activation
 java.xml.bind
 java.xml.ws
 java.xml.ws.annotation
14
© Copyright Azul Systems 2019
Compatibility Not Guaranteed
 New versions of Java may include breaking changes
– Anything for removal will be deprecated first
– Minimum of one release warning
 Could be only six months
15
© Copyright Azul Systems 2019
JDK 10
© Copyright Azul Systems 2019
Local Variable Type Inference (JEP 286)
 Java gets var
17
var userList = new ArrayList<String>(); // infers ArrayList<String>
var stream = list.stream(); // infers Stream<String>
for (var name : userList) { // infers String
...
}
for (var i = 0; i < 10; i++) { // infers int
...
}
© Copyright Azul Systems 2019
var: Clearer try-with-resources
18
try (InputStream inputStream = socket.getInputStream();
InputStreamReader inputStreamReader =
new InputStreamReader(inputStream, UTF_8);
BufferedReader bufferedReader =
new BufferedReader(inputStreamReader)) {
// Use bufferedReader
}
© Copyright Azul Systems 2019
var: Clearer try-with-resources
19
try (var inputStream = socket.getInputStream();
var inputStreamReader = new InputStreamReader(inputStream, UTF_8);
var bufferedReader = new BufferedReader(inputStreamReader)) {
// Use bufferedReader
}
© Copyright Azul Systems 2019
var: Reserved Type (Not Keyword)
var var = new ValueAddedReseller();
public class var {
public var(String x) {
...
}
}
public class Var {
public Var(String x) {
...
}
}
© Copyright Azul Systems 2019
JDK 10: Selected JEPs
 JEP 286: Local-Variable Type Inference
 JEP 307: Parallel Full GC for G1
 JEP 310: Application Class-Data Sharing
 JEP 317: Experimental Java-based JIT compiler (Graal)
 JEP 316: Heap allocation on alternative devices (Intel)
 JEP 312: Thread-local Handshakes
21
© Copyright Azul Systems 2019
JDK 10: APIs
 73 New APIs
– List, Set, Map.copyOf(Collection)
– Collectors
 toUnmodifiableList
 toUnmodifiableMap
 toUnmodifiableSet
– Optional.orElseThrow()
22
© Copyright Azul Systems 2019
JDK 11
© Copyright Azul Systems 2019
323: Extend Local-Variable Syntax
 Local-variable syntax for lambda parameters
24
list.stream()
.map(s -> s.toLowerCase())
.collect(Collectors.toList());
list.stream()
.map((var s) -> s.toLowerCase())
.collect(Collectors.toList());
list.stream()
.map((@Notnull var s) -> s.toLowerCase())
.collect(Collectors.toList());
© Copyright Azul Systems 2019
330: Launch Single File Source Code
 JDK 10 has 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
 JDK 11 adds a forth
– Launch a class declared in a source file
25
$ java Factorial.java 4
© Copyright Azul Systems 2019
Single File Source Code Shebang
26
#!$JAVA_HOME/bin/java --source 11
public class Factorial {
public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
int r = (n == 0) ? 0 : 1;
for (int i = 1; i <= n; i++)
r *= i;
System.out.println("n = " + n + ", n! = " + r);
}
}
$ ./Factorial 4
n = 4, n! = 24
© Copyright Azul Systems 2019
JDK 11 Selected JEPs
 181: Nest-based Access Control
 309: Dynamic Class-file constants
 321: HTTP client
 332: Transport Layer Security (TLS) 1.3
 333: ZGC: Experimental low-latency garbage collector
 318: Epsilon garbage collector
27
© Copyright Azul Systems 2019
New APIs
 New I/O methods
 InputStream nullInputStream()
 OutputStream nullOutputStream()
 Reader nullReader()
 Writer nullWriter()
 Optional
 isEmpty() // Opposite of isPresent
28
© Copyright Azul Systems 2019
New APIs
 New String methods
– isBlank()
– Stream lines()
– String repeat(int)
– String strip()
– String stripLeading()
– String stripTrailing()
29
© Copyright Azul Systems 2019
New APIs
 Predicate not(Predicate)
30
lines.stream()
.filter(s -> !s.isBlank())
lines.stream()
.filter(Predicate.not(String::isBlank))
lines.stream()
.filter(not(String::isBlank))
© Copyright Azul Systems 2019
JDK 11: Modules Removed
– The java.se.ee aggregator-module has been removed
 java.corba
 java.transaction
 java.activation
 java.xml.bind
 java.xml.ws
 java.xml.ws.annotation
31
© Copyright Azul Systems 2019
JDK 12
© Copyright Azul Systems 2019
Switch Expressions
 First preview feature in the OpenJDK
– Not included in the Java SE standard
– Preview features require use of ––enable–preview flag
 Switch construct was a statement
– No concept of generating a result that could be assigned
 Rather clunky syntax
– Every case statement needs to be separated
– Must remember break (default is to fall through)
– Scope of local variables is not intuitive
33
© Copyright Azul Systems 2019
Old-Style Switch Statement
34
int numLetters;
switch (day) {
case MONDAY:
case FRIDAY:
case SUNDAY:
numLetters = 6;
break;
case TUESDAY:
numLetters = 7;
break;
case THURSDAY:
case SATURDAY:
numLetters = 8;
break;
case WEDNESDAY:
numLetters = 9;
break;
default:
throw new IllegalStateException("Huh?: " + day); };
© Copyright Azul Systems 2019
New-Style Switch Expression
int numLetters = switch (day) {
case MONDAY, FRIDAY, SUNDAY -> 6;
case TUESDAY -> 7;
case THURSDAY, SATURDAY -> 8;
case WEDNESDAY -> 9;
default -> throw new IllegalStateException("Huh?: " + day);
};
© Copyright Azul Systems 2019
New Old-Style Switch Expression
int numLetters = switch (day) {
case MONDAY:
case FRIDAY:
case SUNDAY:
break 6;
case TUESDAY
break 7;
case THURSDAY
case SATURDAY
break 8;
case WEDNESDAY
break 9;
default:
throw new IllegalStateException("Huh?: " + day);
};
© Copyright Azul Systems 2019
Switch Expression: Code Blocks
37
int levelResult = switch (level) {
case 1 -> {
var x = computeFrom(level);
logger.info("Level 1 alert");
break x;
}
case 2 -> {
var x = negativeComputeFrom(level);
logger.info("Level 2 alert");
break x;
}
default -> throw new IllegalStateException("What level?: " + level);
};
© Copyright Azul Systems 2019
JDK 12: Selected JEPs
 189: Shenandoah GC (Experimental)
 G1 GC updates
– 344: Abortable mixed collections
– 346: Return unused committed memory
 334: JVM constant API
 341: Default CDS archive
© Copyright Azul Systems 2019
Streams
 New collector, teeing
– teeing(Collector, Collector, BiFunction)
 Collect a stream using two collectors
 Use a BiFunction to merge the two collections
39
Collector 1
Collector 2
BiFunction
Stream Result
© Copyright Azul Systems 2019
Streams
40
// Averaging
Double average = Stream.of(1, 4, 5, 2, 1, 7)
.collect(teeing(summingDouble(i -> i), counting(),
(sum, n) -> sum / n));
© Copyright Azul Systems 2019
JDK 13
© Copyright Azul Systems 2019
Text Blocks
String webPage = """
<html>
<body>
<p>My web page</p>
</body>
</html>
""";
System.out.println(webPage);
$ java WebPage
<html>
<body>
<p>My web page</p>
</body>
</html>
$
© Copyright Azul Systems 2019
Switch Expression
int numLetters = switch (day) {
case MONDAY:
case FRIDAY:
case SUNDAY:
break 6;
case TUESDAY
break 7;
case THURSDAY
case SATURDAY
break 8;
case WEDNESDAY
break 9;
default:
throw new IllegalStateException("Huh?: " + day);
};
© Copyright Azul Systems 2019
Switch Expression (still a preview feature)
int numLetters = switch (day) {
case MONDAY:
case FRIDAY:
case SUNDAY:
yield 6;
case TUESDAY
yield 7;
case THURSDAY
case SATURDAY
yield 8;
case WEDNESDAY
yield 9;
default:
throw new IllegalStateException("Huh?: " + day);
};
© Copyright Azul Systems 2019
Switch Expressions
int numLetters = switch (day) {
case MONDAY, FRIDAY, SUNDAY -> 6;
case TUESDAY -> 7;
case THURSDAY, SATURDAY -> 8;
case WEDNESDAY -> 9;
default -> throw new IllegalStateException("Huh?: " + day);
};
© Copyright Azul Systems 2019
JDK 13: Selected JEPs
 JEP-354: Switch Expressions (Preview)
 JEP-355: Text Blocks (Preview)
 JEP-350: Dynamic CDS Archives
 JEP-351: ZGC (Experimental): Uncommit Unused Memory
 JEP-353: Reimplement the Legacy Socket API
© Copyright Azul Systems 2019
Longer Term JDK Futures
© Copyright Azul Systems 2019
Project Valhalla
 Java has:
– Primitives: for performance
– Objects: for encapsulation, polymorphism, inheritance, OO
 Problem is where we want to use primitives but can't
– ArrayList<int> won't work
– ArrayList<Integer> requires boxing and unboxing,
object creation, heap overhead, indirection reference
48
© Copyright Azul Systems 2019
Project Valhalla
 Value types
 "Codes like a class, works like a primitive"
– Can have methods and fields
– Can implement interfaces
– Can use encapsulation
– Can be generic
– Can't be mutated
– Can't be sub-classed
49
© Copyright Azul Systems 2019
Project Loom
 Further work on making concurrent programming simpler
– Threads are too heavyweight
 Loom will introduce fibres
– JVM level threads (remember green threads?)
– Add continuations to the JVM
– Use the ForkJoinPool scheduler
– Much lighter weight than threads
 Less memory
 Close to zero overhead for task switching
50
© Copyright Azul Systems 2019
Zulu Community
 OpenJDK is a source code project
 Any binary you run comes from some sort of distro
 Many distros of OpenJDK out there
– Some are well built and well tested
– Other are…. Ahem.. Not so much.
– E.g. “Mystery meat OpenJDK builds strike again”
– Zulu, Corretto, Dragonwell, Liberica, Adopt, etc. etc. etc.
– You have plenty of choice…
© Copyright Azul Systems 2019
Zulu Community
© Copyright Azul Systems 2019
Zulu
 A FREE, 100% OSS community distribution of OpenJDK
– Certified Java SE compliant, TCK tested, etc.
 JDK 6*, 7, 8, 9, 10, 11, 12, 13, …
 Curated distribution
– Wide platform support:
 Intel 64-bit & 32-bit Windows, Mac, Linux
 ARM 32-bit and 64-bit
– JFR (Java Flight Recorder) and TLS 1.3 support in JDK 8
– JDK, JRE, JDK+FX, …
53www.zulu.org
© Copyright Azul Systems 2019
Zulu Community
MTS
© Copyright Azul Systems 2019
The need for version overlap
 Major Java releases take time to stabilize post GA
– huge number of bugs are detected via (post-GA) early
adopter exposure
– Java 8 fixed 1,926 bugs in first 17 months
– (1,213 between 6 months and 18 months past GA)
 Production use remains on previous version
– until newly GA’ed version matures
 Production version needs updates during overlap period
– security updates, critical fixes, etc.
55
© Copyright Azul Systems 2019
Java lifecycle: historic al view
56
© Copyright Azul Systems 2019
Java version timeline
57
© Copyright Azul Systems 2019
Zulu LTS
Releases
Prior Zulu Roadmap: LTS
© Copyright Azul Systems 2019
Zulu MTS
Releases
Zulu LTS
Releases
Zulu Roadmap: LTS and MTS
© Copyright Azul Systems 2019
Zulu Enterprise
 Zulu with commercial support
 Releases (LTS, MTS, updates) fit for long term production use
 Timely updates and security fixes (CPU, PSU, etc.)
 Includes indemnification, non-Contamination, etc.
 Used widely across multiple industries
60
© Copyright Azul Systems 2019
Select Azul Customers
© Copyright Azul Systems 2019
Zulu 7, 8, 11, and 13
Azure Spring Cloud
© Copyright Azul Systems 2019
Zulu Enterprise
 Zulu with commercial support
 Releases (LTS, MTS, updates) fit for long term production use
 Timely updates and security fixes (CPU, PSU, etc.)
 Includes indemnification, non-Contamination, etc.
 Used widely across multiple industries
 Java 6, 7, 8, 11, 13, …
 24x7 support
63
© Copyright Azul Systems 2019
Summary
MTS
LTS8
10
9
11 12
17
13
15..
LTS
LTS
..
© Copyright Azul Systems 2019
© Copyright Azul Systems 2015
@giltene
Gil Tene
CTO, Azul Systems
65

More Related Content

PDF
Limits Profiling
PDF
Native interfaces for R
PDF
JDK8: Stream style
PDF
JVM Mechanics
PDF
TensorFlow XLA RPC
DOC
Network security mannual (2)
PDF
Java Performance Puzzlers
PDF
JVM Mechanics: Understanding the JIT's Tricks
Limits Profiling
Native interfaces for R
JDK8: Stream style
JVM Mechanics
TensorFlow XLA RPC
Network security mannual (2)
Java Performance Puzzlers
JVM Mechanics: Understanding the JIT's Tricks

What's hot (20)

DOC
Network security Lab manual
PDF
Google Edge TPUで TensorFlow Liteを使った時に 何をやっているのかを妄想してみる 2 「エッジAIモダン計測制御の世界」オ...
PDF
Java Performance: Speedup your application with hardware counters
PDF
Concurrency Concepts in Java
PPTX
05 pig user defined functions (udfs)
PDF
The Ring programming language version 1.5.3 book - Part 14 of 184
PDF
Architecture Patterns in Practice with Kotlin. UA Mobile 2017.
PDF
IT6712 lab manual
PDF
Dagger & rxjava & retrofit
PDF
57200143 flash-action-script-quickref
PPTX
C ISRO Debugging
PDF
エンタープライズ・クラウドと 並列・分散・非同期処理
PDF
Reactive Programming for a demanding world: building event-driven and respons...
PDF
TensorFlow local Python XLA client
PDF
Production Time Profiling and Diagnostics on the JVM
PDF
The Ring programming language version 1.8 book - Part 18 of 202
ODP
Java Generics
PPTX
Reactive Programming on Android
PPTX
05 - Bypassing DEP, or why ASLR matters
PPTX
Android audio system(audioflinger)
Network security Lab manual
Google Edge TPUで TensorFlow Liteを使った時に 何をやっているのかを妄想してみる 2 「エッジAIモダン計測制御の世界」オ...
Java Performance: Speedup your application with hardware counters
Concurrency Concepts in Java
05 pig user defined functions (udfs)
The Ring programming language version 1.5.3 book - Part 14 of 184
Architecture Patterns in Practice with Kotlin. UA Mobile 2017.
IT6712 lab manual
Dagger & rxjava & retrofit
57200143 flash-action-script-quickref
C ISRO Debugging
エンタープライズ・クラウドと 並列・分散・非同期処理
Reactive Programming for a demanding world: building event-driven and respons...
TensorFlow local Python XLA client
Production Time Profiling and Diagnostics on the JVM
The Ring programming language version 1.8 book - Part 18 of 202
Java Generics
Reactive Programming on Android
05 - Bypassing DEP, or why ASLR matters
Android audio system(audioflinger)
Ad

Similar to Keeping Up with Java: Look at All These New Features! (20)

PPTX
Java after 8
PPTX
Moving Towards JDK 12
PPTX
JDK 14 Lots of New Features
PPTX
Hacking for Fun and Profit (Mostly for Fun). AnDevCon Boston
PDF
PPTX
Whats New For Developers In JDK 9
PPT
C# Basics
PDF
Priming Java for Speed at Market Open
PPT
Groovy Introduction - JAX Germany - 2008
PDF
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
PPTX
JDK 9, 10, 11 and Beyond
PPTX
Mastering the Sling Rewriter by Justin Edelson
PPTX
Mastering the Sling Rewriter
PPTX
Ingesting streaming data for analysis in apache ignite (stream sets theme)
PPTX
JDK 9: The Start of a New Future for Java
PDF
Novidades do Java SE 8
PPT
Android - Anatomy of android elements & layouts
PDF
Pebank java handsout
PPTX
Lambdas puzzler - Peter Lawrey
PPTX
JDK 9, 10, 11 and Beyond
Java after 8
Moving Towards JDK 12
JDK 14 Lots of New Features
Hacking for Fun and Profit (Mostly for Fun). AnDevCon Boston
Whats New For Developers In JDK 9
C# Basics
Priming Java for Speed at Market Open
Groovy Introduction - JAX Germany - 2008
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
JDK 9, 10, 11 and Beyond
Mastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter
Ingesting streaming data for analysis in apache ignite (stream sets theme)
JDK 9: The Start of a New Future for Java
Novidades do Java SE 8
Android - Anatomy of android elements & layouts
Pebank java handsout
Lambdas puzzler - Peter Lawrey
JDK 9, 10, 11 and Beyond
Ad

More from VMware Tanzu (20)

PDF
Spring into AI presented by Dan Vega 5/14
PDF
What AI Means For Your Product Strategy And What To Do About It
PDF
Make the Right Thing the Obvious Thing at Cardinal Health 2023
PPTX
Enhancing DevEx and Simplifying Operations at Scale
PDF
Spring Update | July 2023
PPTX
Platforms, Platform Engineering, & Platform as a Product
PPTX
Building Cloud Ready Apps
PDF
Spring Boot 3 And Beyond
PDF
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
PDF
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
PDF
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
PPTX
tanzu_developer_connect.pptx
PDF
Tanzu Virtual Developer Connect Workshop - French
PDF
Tanzu Developer Connect Workshop - English
PDF
Virtual Developer Connect Workshop - English
PDF
Tanzu Developer Connect - French
PDF
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
PDF
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
PDF
SpringOne Tour: The Influential Software Engineer
PDF
SpringOne Tour: Domain-Driven Design: Theory vs Practice
Spring into AI presented by Dan Vega 5/14
What AI Means For Your Product Strategy And What To Do About It
Make the Right Thing the Obvious Thing at Cardinal Health 2023
Enhancing DevEx and Simplifying Operations at Scale
Spring Update | July 2023
Platforms, Platform Engineering, & Platform as a Product
Building Cloud Ready Apps
Spring Boot 3 And Beyond
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
tanzu_developer_connect.pptx
Tanzu Virtual Developer Connect Workshop - French
Tanzu Developer Connect Workshop - English
Virtual Developer Connect Workshop - English
Tanzu Developer Connect - French
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: The Influential Software Engineer
SpringOne Tour: Domain-Driven Design: Theory vs Practice

Recently uploaded (20)

PDF
medical staffing services at VALiNTRY
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
Introduction to Artificial Intelligence
PDF
System and Network Administration Chapter 2
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
top salesforce developer skills in 2025.pdf
PPTX
Transform Your Business with a Software ERP System
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Digital Strategies for Manufacturing Companies
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Understanding Forklifts - TECH EHS Solution
medical staffing services at VALiNTRY
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Introduction to Artificial Intelligence
System and Network Administration Chapter 2
Digital Systems & Binary Numbers (comprehensive )
How to Choose the Right IT Partner for Your Business in Malaysia
CHAPTER 2 - PM Management and IT Context
Which alternative to Crystal Reports is best for small or large businesses.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Reimagine Home Health with the Power of Agentic AI​
2025 Textile ERP Trends: SAP, Odoo & Oracle
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
top salesforce developer skills in 2025.pdf
Transform Your Business with a Software ERP System
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Navsoft: AI-Powered Business Solutions & Custom Software Development
Digital Strategies for Manufacturing Companies
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Understanding Forklifts - TECH EHS Solution

Keeping Up with Java: Look at All These New Features!

  • 1. © Copyright Azul Systems 2019 © Copyright Azul Systems 2015 @giltene Keeping Up with Java: Look at All These New Features! Gil Tene CTO, Azul Systems 1
  • 2. © Copyright Azul Systems 2019 © Copyright Azul Systems 2015 @giltene From JDK 9 To 13 And Beyond Gil Tene CTO, Azul Systems 2
  • 3. © Copyright Azul Systems 2019 © Copyright Azul Systems 2015 @giltene Java After 8 Gil Tene 3
  • 4. © Copyright Azul Systems 2019 © Copyright Azul Systems 2015 @giltene Java After 8 Gil Tene CTO, Azul Systems 4
  • 5. © Copyright Azul Systems 2019 Changes…  Java 6 2006 (December)  Java 7 2011 (July)  Java 8 2014 (March)  Java 9 2017 (September)  Java 10 2018 (18.3)  Java 11 2018 (18.9)  Java 12 2019 (19.3)  Java 13 2019 (19.9)  Java 14 2020 (20.3) … 5
  • 6. © Copyright Azul Systems 2019 Java version timeline 6
  • 7. © Copyright Azul Systems 2019 Coming up to speed  “Current” Java is 13, or 11 – Depending on who you talk to  Consider changes from your “current” version  For most of you, that’s Java 8  So need to go over Java 9, 10, 11, 12, 13,… 7
  • 8. © Copyright Azul Systems 2019 Changes…  Java the language (“Java 13”) – the syntax, the meaning  Java SE the platform (“Java 13”, “JDK 13”, “Java SE 13”) – specified APIs, packages, behaviour  OpenJDK: an implementation (“OpenJDK 13”) – under the hood stuff – garbage collectors, CDS, … 8
  • 9. © Copyright Azul Systems 2019 JDK 9: Big And Small Changes 9
  • 10. © Copyright Azul Systems 2019 Java Platform Module System (JPMS)  The core Java libraries are now a set of modules (JEP 220) – 75 OpenJDK modules:  24 Java SE  2 aggregator modules  1 smartcard (???)  48 JDK  Most internal APIs now encapsulated (JEP 260) – sun.misc.Unsafe – Some can be used with command line options 10
  • 11. © Copyright Azul Systems 2019 jlink: The Java Linker (JEP 282) $ jlink --module-path $JDKMODS:$MYMODS --addmods com.azul.zapp –-output myimage $ myimage/bin/java –-list-modules java.base@9 java.logging@9 java.sql@9 java.xml@9 com.azul.zapp@1.0 com.azul.zoop@1.0 com.azul.zeta@1.0 myimage …confbin jlink lib
  • 12. © Copyright Azul Systems 2019 JDK 9: The Clean Up Starts  JDK 9 was a significant change for Java – Deprecated APIs were removed for the first time  Six methods and one class  JDK 10 removed 1 package, 6 classes, 9 methods and 1 field – Parts of the platform were removed for the first time  The entire java.se.ee aggregator module was “hidden” in JDK 9  And completely removed in JDK 11  JDK 10, 11, 12, 13, 14… continue this work  More features will be removed in the future  CMS GC, Nashorn and Pack200 all deprecated. Others? 12
  • 13. © Copyright Azul Systems 2019 JDK 9 Onwards And Compatibility 13 "Clean applications that just depend on java.se should just work" - Oracle • Note careful spelling of “java.se” • ”java.se” refers to an aggregator module in JDK 9+ • Java SE 8 parts are absolutely being removed
  • 14. © Copyright Azul Systems 2019 Platform parts removed – The java.se.ee aggregator-module  java.corba  java.transaction  java.activation  java.xml.bind  java.xml.ws  java.xml.ws.annotation 14
  • 15. © Copyright Azul Systems 2019 Compatibility Not Guaranteed  New versions of Java may include breaking changes – Anything for removal will be deprecated first – Minimum of one release warning  Could be only six months 15
  • 16. © Copyright Azul Systems 2019 JDK 10
  • 17. © Copyright Azul Systems 2019 Local Variable Type Inference (JEP 286)  Java gets var 17 var userList = new ArrayList<String>(); // infers ArrayList<String> var stream = list.stream(); // infers Stream<String> for (var name : userList) { // infers String ... } for (var i = 0; i < 10; i++) { // infers int ... }
  • 18. © Copyright Azul Systems 2019 var: Clearer try-with-resources 18 try (InputStream inputStream = socket.getInputStream(); InputStreamReader inputStreamReader = new InputStreamReader(inputStream, UTF_8); BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) { // Use bufferedReader }
  • 19. © Copyright Azul Systems 2019 var: Clearer try-with-resources 19 try (var inputStream = socket.getInputStream(); var inputStreamReader = new InputStreamReader(inputStream, UTF_8); var bufferedReader = new BufferedReader(inputStreamReader)) { // Use bufferedReader }
  • 20. © Copyright Azul Systems 2019 var: Reserved Type (Not Keyword) var var = new ValueAddedReseller(); public class var { public var(String x) { ... } } public class Var { public Var(String x) { ... } }
  • 21. © Copyright Azul Systems 2019 JDK 10: Selected JEPs  JEP 286: Local-Variable Type Inference  JEP 307: Parallel Full GC for G1  JEP 310: Application Class-Data Sharing  JEP 317: Experimental Java-based JIT compiler (Graal)  JEP 316: Heap allocation on alternative devices (Intel)  JEP 312: Thread-local Handshakes 21
  • 22. © Copyright Azul Systems 2019 JDK 10: APIs  73 New APIs – List, Set, Map.copyOf(Collection) – Collectors  toUnmodifiableList  toUnmodifiableMap  toUnmodifiableSet – Optional.orElseThrow() 22
  • 23. © Copyright Azul Systems 2019 JDK 11
  • 24. © Copyright Azul Systems 2019 323: Extend Local-Variable Syntax  Local-variable syntax for lambda parameters 24 list.stream() .map(s -> s.toLowerCase()) .collect(Collectors.toList()); list.stream() .map((var s) -> s.toLowerCase()) .collect(Collectors.toList()); list.stream() .map((@Notnull var s) -> s.toLowerCase()) .collect(Collectors.toList());
  • 25. © Copyright Azul Systems 2019 330: Launch Single File Source Code  JDK 10 has 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  JDK 11 adds a forth – Launch a class declared in a source file 25 $ java Factorial.java 4
  • 26. © Copyright Azul Systems 2019 Single File Source Code Shebang 26 #!$JAVA_HOME/bin/java --source 11 public class Factorial { public static void main(String[] args) { int n = Integer.parseInt(args[0]); int r = (n == 0) ? 0 : 1; for (int i = 1; i <= n; i++) r *= i; System.out.println("n = " + n + ", n! = " + r); } } $ ./Factorial 4 n = 4, n! = 24
  • 27. © Copyright Azul Systems 2019 JDK 11 Selected JEPs  181: Nest-based Access Control  309: Dynamic Class-file constants  321: HTTP client  332: Transport Layer Security (TLS) 1.3  333: ZGC: Experimental low-latency garbage collector  318: Epsilon garbage collector 27
  • 28. © Copyright Azul Systems 2019 New APIs  New I/O methods  InputStream nullInputStream()  OutputStream nullOutputStream()  Reader nullReader()  Writer nullWriter()  Optional  isEmpty() // Opposite of isPresent 28
  • 29. © Copyright Azul Systems 2019 New APIs  New String methods – isBlank() – Stream lines() – String repeat(int) – String strip() – String stripLeading() – String stripTrailing() 29
  • 30. © Copyright Azul Systems 2019 New APIs  Predicate not(Predicate) 30 lines.stream() .filter(s -> !s.isBlank()) lines.stream() .filter(Predicate.not(String::isBlank)) lines.stream() .filter(not(String::isBlank))
  • 31. © Copyright Azul Systems 2019 JDK 11: Modules Removed – The java.se.ee aggregator-module has been removed  java.corba  java.transaction  java.activation  java.xml.bind  java.xml.ws  java.xml.ws.annotation 31
  • 32. © Copyright Azul Systems 2019 JDK 12
  • 33. © Copyright Azul Systems 2019 Switch Expressions  First preview feature in the OpenJDK – Not included in the Java SE standard – Preview features require use of ––enable–preview flag  Switch construct was a statement – No concept of generating a result that could be assigned  Rather clunky syntax – Every case statement needs to be separated – Must remember break (default is to fall through) – Scope of local variables is not intuitive 33
  • 34. © Copyright Azul Systems 2019 Old-Style Switch Statement 34 int numLetters; switch (day) { case MONDAY: case FRIDAY: case SUNDAY: numLetters = 6; break; case TUESDAY: numLetters = 7; break; case THURSDAY: case SATURDAY: numLetters = 8; break; case WEDNESDAY: numLetters = 9; break; default: throw new IllegalStateException("Huh?: " + day); };
  • 35. © Copyright Azul Systems 2019 New-Style Switch Expression int numLetters = switch (day) { case MONDAY, FRIDAY, SUNDAY -> 6; case TUESDAY -> 7; case THURSDAY, SATURDAY -> 8; case WEDNESDAY -> 9; default -> throw new IllegalStateException("Huh?: " + day); };
  • 36. © Copyright Azul Systems 2019 New Old-Style Switch Expression int numLetters = switch (day) { case MONDAY: case FRIDAY: case SUNDAY: break 6; case TUESDAY break 7; case THURSDAY case SATURDAY break 8; case WEDNESDAY break 9; default: throw new IllegalStateException("Huh?: " + day); };
  • 37. © Copyright Azul Systems 2019 Switch Expression: Code Blocks 37 int levelResult = switch (level) { case 1 -> { var x = computeFrom(level); logger.info("Level 1 alert"); break x; } case 2 -> { var x = negativeComputeFrom(level); logger.info("Level 2 alert"); break x; } default -> throw new IllegalStateException("What level?: " + level); };
  • 38. © Copyright Azul Systems 2019 JDK 12: Selected JEPs  189: Shenandoah GC (Experimental)  G1 GC updates – 344: Abortable mixed collections – 346: Return unused committed memory  334: JVM constant API  341: Default CDS archive
  • 39. © Copyright Azul Systems 2019 Streams  New collector, teeing – teeing(Collector, Collector, BiFunction)  Collect a stream using two collectors  Use a BiFunction to merge the two collections 39 Collector 1 Collector 2 BiFunction Stream Result
  • 40. © Copyright Azul Systems 2019 Streams 40 // Averaging Double average = Stream.of(1, 4, 5, 2, 1, 7) .collect(teeing(summingDouble(i -> i), counting(), (sum, n) -> sum / n));
  • 41. © Copyright Azul Systems 2019 JDK 13
  • 42. © Copyright Azul Systems 2019 Text Blocks String webPage = """ <html> <body> <p>My web page</p> </body> </html> """; System.out.println(webPage); $ java WebPage <html> <body> <p>My web page</p> </body> </html> $
  • 43. © Copyright Azul Systems 2019 Switch Expression int numLetters = switch (day) { case MONDAY: case FRIDAY: case SUNDAY: break 6; case TUESDAY break 7; case THURSDAY case SATURDAY break 8; case WEDNESDAY break 9; default: throw new IllegalStateException("Huh?: " + day); };
  • 44. © Copyright Azul Systems 2019 Switch Expression (still a preview feature) int numLetters = switch (day) { case MONDAY: case FRIDAY: case SUNDAY: yield 6; case TUESDAY yield 7; case THURSDAY case SATURDAY yield 8; case WEDNESDAY yield 9; default: throw new IllegalStateException("Huh?: " + day); };
  • 45. © Copyright Azul Systems 2019 Switch Expressions int numLetters = switch (day) { case MONDAY, FRIDAY, SUNDAY -> 6; case TUESDAY -> 7; case THURSDAY, SATURDAY -> 8; case WEDNESDAY -> 9; default -> throw new IllegalStateException("Huh?: " + day); };
  • 46. © Copyright Azul Systems 2019 JDK 13: Selected JEPs  JEP-354: Switch Expressions (Preview)  JEP-355: Text Blocks (Preview)  JEP-350: Dynamic CDS Archives  JEP-351: ZGC (Experimental): Uncommit Unused Memory  JEP-353: Reimplement the Legacy Socket API
  • 47. © Copyright Azul Systems 2019 Longer Term JDK Futures
  • 48. © Copyright Azul Systems 2019 Project Valhalla  Java has: – Primitives: for performance – Objects: for encapsulation, polymorphism, inheritance, OO  Problem is where we want to use primitives but can't – ArrayList<int> won't work – ArrayList<Integer> requires boxing and unboxing, object creation, heap overhead, indirection reference 48
  • 49. © Copyright Azul Systems 2019 Project Valhalla  Value types  "Codes like a class, works like a primitive" – Can have methods and fields – Can implement interfaces – Can use encapsulation – Can be generic – Can't be mutated – Can't be sub-classed 49
  • 50. © Copyright Azul Systems 2019 Project Loom  Further work on making concurrent programming simpler – Threads are too heavyweight  Loom will introduce fibres – JVM level threads (remember green threads?) – Add continuations to the JVM – Use the ForkJoinPool scheduler – Much lighter weight than threads  Less memory  Close to zero overhead for task switching 50
  • 51. © Copyright Azul Systems 2019 Zulu Community  OpenJDK is a source code project  Any binary you run comes from some sort of distro  Many distros of OpenJDK out there – Some are well built and well tested – Other are…. Ahem.. Not so much. – E.g. “Mystery meat OpenJDK builds strike again” – Zulu, Corretto, Dragonwell, Liberica, Adopt, etc. etc. etc. – You have plenty of choice…
  • 52. © Copyright Azul Systems 2019 Zulu Community
  • 53. © Copyright Azul Systems 2019 Zulu  A FREE, 100% OSS community distribution of OpenJDK – Certified Java SE compliant, TCK tested, etc.  JDK 6*, 7, 8, 9, 10, 11, 12, 13, …  Curated distribution – Wide platform support:  Intel 64-bit & 32-bit Windows, Mac, Linux  ARM 32-bit and 64-bit – JFR (Java Flight Recorder) and TLS 1.3 support in JDK 8 – JDK, JRE, JDK+FX, … 53www.zulu.org
  • 54. © Copyright Azul Systems 2019 Zulu Community MTS
  • 55. © Copyright Azul Systems 2019 The need for version overlap  Major Java releases take time to stabilize post GA – huge number of bugs are detected via (post-GA) early adopter exposure – Java 8 fixed 1,926 bugs in first 17 months – (1,213 between 6 months and 18 months past GA)  Production use remains on previous version – until newly GA’ed version matures  Production version needs updates during overlap period – security updates, critical fixes, etc. 55
  • 56. © Copyright Azul Systems 2019 Java lifecycle: historic al view 56
  • 57. © Copyright Azul Systems 2019 Java version timeline 57
  • 58. © Copyright Azul Systems 2019 Zulu LTS Releases Prior Zulu Roadmap: LTS
  • 59. © Copyright Azul Systems 2019 Zulu MTS Releases Zulu LTS Releases Zulu Roadmap: LTS and MTS
  • 60. © Copyright Azul Systems 2019 Zulu Enterprise  Zulu with commercial support  Releases (LTS, MTS, updates) fit for long term production use  Timely updates and security fixes (CPU, PSU, etc.)  Includes indemnification, non-Contamination, etc.  Used widely across multiple industries 60
  • 61. © Copyright Azul Systems 2019 Select Azul Customers
  • 62. © Copyright Azul Systems 2019 Zulu 7, 8, 11, and 13 Azure Spring Cloud
  • 63. © Copyright Azul Systems 2019 Zulu Enterprise  Zulu with commercial support  Releases (LTS, MTS, updates) fit for long term production use  Timely updates and security fixes (CPU, PSU, etc.)  Includes indemnification, non-Contamination, etc.  Used widely across multiple industries  Java 6, 7, 8, 11, 13, …  24x7 support 63
  • 64. © Copyright Azul Systems 2019 Summary MTS LTS8 10 9 11 12 17 13 15.. LTS LTS ..
  • 65. © Copyright Azul Systems 2019 © Copyright Azul Systems 2015 @giltene Gil Tene CTO, Azul Systems 65