SlideShare a Scribd company logo
1 of 25
© Copyright Azul Systems 2020
© Copyright Azul Systems 2015
@speakjava
JDK 14:
Lots of New Features
Simon Ritter
Deputy CTO, Azul Systems
1
© Copyright Azul Systems 2020
OpenJDK: New Release Model
 A new version of the JDK is released every six months
– March and September
– 2018: JDK 10 and 11, 2019: JDK 12 and 13
– Continuing this year with JDK 14 and JDK 15
 OpenJDK development is more agile
 Features are only included when ready
2
© Copyright Azul Systems 2020
Incubators And Previews
 Add new features to OpenJDK
 Without making it standard
 Time for feedback and changes (or removal)
 Incubator modules (JEP 11)
 API and tool changes
 Started in JDK 9 with HTTP/2
 Preview features (JEP 12)
 Language and VM changes
 Started in JDK 12 with switch expression
3
© Copyright Azul Systems 2020
JDK 14: Big Features
 Language level
– JEP 359: Records (preview)
– JEP 305: Pattern matching for instanceof (preview)
– JEP 368: Text blocks (second preview)
 API Changes
– Record related changes
– Foreign memory access API (incubator module)
4
© Copyright Azul Systems 2020
Simple Java Data Class
5
class Point {
private final double x;
private final double y;
public Point(double x, double y) {
this.x = x;
this.y = y;
}
public double getX() {
return x;
}
public double getY() {
return y;
}
}
© Copyright Azul Systems 2020
Records (Preview)
6
record Point(double x, double y) { }
record Range(double low, double high) {
public Range {
if (low > high)
throw new IllegalArgumentException("Bad values");
}
public String toString() {
return "Point is (" + x + ", " + y + ")";
}
}
© Copyright Azul Systems 2020
Using instanceof
7
if (obj instanceof String) {
String s = (String)obj;
System.out.println(s.length());
}
© Copyright Azul Systems 2020
Pattern Matching instanceof (Preview)
8
if (obj instanceof String s) {
System.out.println(s.length());
} else {
// Use of s not allowed here
}
if (obj instanceof String s && s.length() > 0)
System.out.println(s.length());
// Compiler error
if (obj instanceof String s || s.length() > 0)
System.out.println(s.length());
© Copyright Azul Systems 2020
Pattern Matching instanceof (Preview)
if (!(o instanceof String s))
return;
System.out.println(s.length());
© Copyright Azul Systems 2020
Text Blocks (Second Preview)
 Two new escape sequences
String continuous = """This line will not 
contain a newline in the middle""";
String colours = """Red s
greens
blue s
""";
© Copyright Azul Systems 2020
Switch Expression
 JEP 361: Switch Expressions (standard)
– No more changes from the second preview (JDK 13)
– Now a standard feature in JDK 14
 No --enable-preview flag necessary
 Included in the Java SE specification
11
© Copyright Azul Systems 2020
Helpful NullPointerException
 Who's never had an NullPointerException?
12
a.b.c.i = 99;
Exception in thread "main" java.lang.NullPointerException
at Prog.main(Prog.java:5)
Exception in thread "main" java.lang.NullPointerException:
Cannot read field "c" because "a.b" is null
at Prog.main(Prog.java:5)
© Copyright Azul Systems 2020
Other Feature JEPs
 343: Packaging tool (incubator)
 345: NUMA aware memory allocation for G1
 349: Java Flight Recorder streaming events
 352: Non-volatile mapped byte buffers
 364/365: ZGC on Windows/macOS
13
© Copyright Azul Systems 2020
Deprecation and Removal JEPs
 363: Remove the CMS collector
 362: Deprecate the Solaris and SPARC ports
 366: Deprecate ParallelScavenge + SerialOld GC combo
 367: Remove the Pack200 tools and API
14
© Copyright Azul Systems 2020
API Changes
© Copyright Azul Systems 2020
Foreign-Memory Access API
 Alternative to parts of sun.misc.Unsafe and
MappedByteBuffer
– MemorySegment
– MemoryAddress
– MemoryLayout
16
© Copyright Azul Systems 2020
Record Related APIs
 Class
 isRecord()
 RecordComponent[] getRecordComponents()
 java.lang.Record
 java.lang.annotation.ElementType
 RECORD_TYPE
 java.lang.runtime
 New package for records
 ObjectMethods class with bootstrap()
 javax.lang.mode.util new classes
17
© Copyright Azul Systems 2020
Serial Annotation
 Used for compiler checks of Serializable classes
 Use with these methods
 writeObject
 readObject
 readObjectNoData
 writeReplace
 readResolve
 And these fields
 serialPersistentFields
 serialVersionUID
18
© Copyright Azul Systems 2020
Miscellaneous
 NullPointerException
 Now overrides getMessage() from Throwable
 StrictMath
 New exact methods: incrementExact(), decrementExact(),
negateExact()
 CompactNumberFormat
 pluralRules()
 HashSet
 toArray()
19
© Copyright Azul Systems 2020
Azul's Zulu Java
© Copyright Azul Systems 2020
Zulu Community
 Azul’s FREE binary distribution of OpenJDK
 Passes all TCK tests
 Versions: JDK 6-14 available
 JDK 15 available as Early Access
 Wide platform support:
 Intel 64-bit Windows, Mac, Linux
 Intel 32-bit Windows and Linux
 ARM 32 and 64-bit
 PPC 32 and 64-bit
 Solaris 10/11 on SPARC
21
www.azul.com/downloads/zulu
© Copyright Azul Systems 2020
Zulu Enterprise
 Backporting of bug fixes and security patches from
supported OpenJDK release
 Zulu 8 supported until end of 2030
 Zulu 6 supported until end of 2021
 LTS releases have 8 years active + 2 years passive support
 Medium Term Support releases
– Two interim releases between LTS releases (13, 15...)
– Bridge to LTS releases
– Supported until 18 months after next LTS release
22
© Copyright Azul Systems 2020
Summary
© Copyright Azul Systems 2020
JDK 14: A Great Release
 Powerful new language features
– Records
– Pattern matching for instanceof
 Better NullPointerException messages
 Useful API changes
– Foreign memory access API
 Keeping Java fresh after 25 years!
24
© Copyright Azul Systems 2020
© Copyright Azul Systems 2015
@speakjava
Thank You!
Simon Ritter
Deputy CTO, Azul Systems
25

More Related Content

What's hot

Lessons Learnt With Lambdas and Streams in JDK 8
Lessons Learnt With Lambdas and Streams in JDK 8Lessons Learnt With Lambdas and Streams in JDK 8
Lessons Learnt With Lambdas and Streams in JDK 8Simon Ritter
 
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java VersionsTWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java VersionsJoseph Kuo
 
Lambdas Hands On Lab
Lambdas Hands On LabLambdas Hands On Lab
Lambdas Hands On LabSimon Ritter
 
JCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJoseph Kuo
 
Java SE 8 - New Features
Java SE 8 - New FeaturesJava SE 8 - New Features
Java SE 8 - New FeaturesNaveen Hegde
 
55 New Features in Java SE 8
55 New Features in Java SE 855 New Features in Java SE 8
55 New Features in Java SE 8Simon Ritter
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaHenri Tremblay
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7Deniz Oguz
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8Martin Toshev
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 
RxJava 2.0 介紹
RxJava 2.0 介紹RxJava 2.0 介紹
RxJava 2.0 介紹Kros Huang
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for AndroidTomáš Kypta
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKJosé Paumard
 
Rxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaRxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaKros Huang
 
Java features. Java 8, 9, 10, 11
Java features. Java 8, 9, 10, 11Java features. Java 8, 9, 10, 11
Java features. Java 8, 9, 10, 11Ivelin Yanev
 
Pure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools RacePure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools RaceBaruch Sadogursky
 

What's hot (20)

Lessons Learnt With Lambdas and Streams in JDK 8
Lessons Learnt With Lambdas and Streams in JDK 8Lessons Learnt With Lambdas and Streams in JDK 8
Lessons Learnt With Lambdas and Streams in JDK 8
 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8
 
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java VersionsTWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
 
Lambdas Hands On Lab
Lambdas Hands On LabLambdas Hands On Lab
Lambdas Hands On Lab
 
Java 8 Feature Preview
Java 8 Feature PreviewJava 8 Feature Preview
Java 8 Feature Preview
 
JCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of Java
 
Java 8 Features
Java 8 FeaturesJava 8 Features
Java 8 Features
 
Java SE 8 - New Features
Java SE 8 - New FeaturesJava SE 8 - New Features
Java SE 8 - New Features
 
55 New Features in Java SE 8
55 New Features in Java SE 855 New Features in Java SE 8
55 New Features in Java SE 8
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern Java
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
RxJava 2.0 介紹
RxJava 2.0 介紹RxJava 2.0 介紹
RxJava 2.0 介紹
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UK
 
Java 7 New Features
Java 7 New FeaturesJava 7 New Features
Java 7 New Features
 
Rxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaRxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJava
 
Java features. Java 8, 9, 10, 11
Java features. Java 8, 9, 10, 11Java features. Java 8, 9, 10, 11
Java features. Java 8, 9, 10, 11
 
Pure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools RacePure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools Race
 

Similar to JDK 14 Lots of New Features

JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondSimon Ritter
 
Java one 2010
Java one 2010Java one 2010
Java one 2010scdn
 
4CS4-25-Java-Lab-Manual.pdf
4CS4-25-Java-Lab-Manual.pdf4CS4-25-Java-Lab-Manual.pdf
4CS4-25-Java-Lab-Manual.pdfamitbhachne
 
JDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for JavaJDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for JavaSimon Ritter
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningCarol McDonald
 
I/O (imput/output) [JAVA]
I/O  (imput/output) [JAVA]I/O  (imput/output) [JAVA]
I/O (imput/output) [JAVA]Hack '
 
Is Java Still Free?
Is Java Still Free?Is Java Still Free?
Is Java Still Free?Simon Ritter
 
Keeping Up with Java: Look at All These New Features!
Keeping Up with Java: Look at All These New Features!Keeping Up with Java: Look at All These New Features!
Keeping Up with Java: Look at All These New Features!VMware Tanzu
 
Whats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ DevelopersWhats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ DevelopersRainer Stropek
 
Java programming concept
Java programming conceptJava programming concept
Java programming conceptSanjay Gunjal
 
Production Time Profiling and Diagnostics on the JVM
Production Time Profiling and Diagnostics on the JVMProduction Time Profiling and Diagnostics on the JVM
Production Time Profiling and Diagnostics on the JVMMarcus Hirt
 
OpenDaylight and YANG
OpenDaylight and YANGOpenDaylight and YANG
OpenDaylight and YANGCoreStack
 

Similar to JDK 14 Lots of New Features (20)

JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 
Java one 2010
Java one 2010Java one 2010
Java one 2010
 
4CS4-25-Java-Lab-Manual.pdf
4CS4-25-Java-Lab-Manual.pdf4CS4-25-Java-Lab-Manual.pdf
4CS4-25-Java-Lab-Manual.pdf
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 
JDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for JavaJDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for Java
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
 
I/O (imput/output) [JAVA]
I/O  (imput/output) [JAVA]I/O  (imput/output) [JAVA]
I/O (imput/output) [JAVA]
 
Is Java Still Free?
Is Java Still Free?Is Java Still Free?
Is Java Still Free?
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 
Keeping Up with Java: Look at All These New Features!
Keeping Up with Java: Look at All These New Features!Keeping Up with Java: Look at All These New Features!
Keeping Up with Java: Look at All These New Features!
 
Whats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ DevelopersWhats New in Visual Studio 2012 for C++ Developers
Whats New in Visual Studio 2012 for C++ Developers
 
00_Introduction to Java.ppt
00_Introduction to Java.ppt00_Introduction to Java.ppt
00_Introduction to Java.ppt
 
Colloquium Report
Colloquium ReportColloquium Report
Colloquium Report
 
Java programming concept
Java programming conceptJava programming concept
Java programming concept
 
Production Time Profiling and Diagnostics on the JVM
Production Time Profiling and Diagnostics on the JVMProduction Time Profiling and Diagnostics on the JVM
Production Time Profiling and Diagnostics on the JVM
 
OpenDaylight and YANG
OpenDaylight and YANGOpenDaylight and YANG
OpenDaylight and YANG
 
Java 7: Quo vadis?
Java 7: Quo vadis?Java 7: Quo vadis?
Java 7: Quo vadis?
 

More from Simon Ritter

Cloud Native Compiler
Cloud Native CompilerCloud Native Compiler
Cloud Native CompilerSimon Ritter
 
The Art of Java Type Patterns
The Art of Java Type PatternsThe Art of Java Type Patterns
The Art of Java Type PatternsSimon Ritter
 
Java performance monitoring
Java performance monitoringJava performance monitoring
Java performance monitoringSimon Ritter
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java WorkshopSimon Ritter
 
Building a Better JVM
Building a Better JVMBuilding a Better JVM
Building a Better JVMSimon Ritter
 
The Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologyThe Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologySimon Ritter
 
Developing Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologyDeveloping Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologySimon Ritter
 
Java Is Still Free
Java Is Still FreeJava Is Still Free
Java Is Still FreeSimon Ritter
 
Java Support: What's changing
Java Support:  What's changingJava Support:  What's changing
Java Support: What's changingSimon Ritter
 
JDK 9: Mission Accomplished. What Next For Java?
JDK 9: Mission Accomplished. What Next For Java?JDK 9: Mission Accomplished. What Next For Java?
JDK 9: Mission Accomplished. What Next For Java?Simon Ritter
 
JDK 9: Migrating Applications
JDK 9: Migrating ApplicationsJDK 9: Migrating Applications
JDK 9: Migrating ApplicationsSimon Ritter
 
Building a Brain with Raspberry Pi and Zulu Embedded JVM
Building a Brain with Raspberry Pi and Zulu Embedded JVMBuilding a Brain with Raspberry Pi and Zulu Embedded JVM
Building a Brain with Raspberry Pi and Zulu Embedded JVMSimon Ritter
 
It's Java, Jim, but not as we know it
It's Java, Jim, but not as we know itIt's Java, Jim, but not as we know it
It's Java, Jim, but not as we know itSimon Ritter
 
Whats New For Developers In JDK 9
Whats New For Developers In JDK 9Whats New For Developers In JDK 9
Whats New For Developers In JDK 9Simon Ritter
 
JDK 9: 55 New Features
JDK 9: 55 New FeaturesJDK 9: 55 New Features
JDK 9: 55 New FeaturesSimon Ritter
 
Streams: The Good, The Bad And The Ugly
Streams: The Good, The Bad And The UglyStreams: The Good, The Bad And The Ugly
Streams: The Good, The Bad And The UglySimon Ritter
 
Is An Agile Standard Possible For Java?
Is An Agile Standard Possible For Java?Is An Agile Standard Possible For Java?
Is An Agile Standard Possible For Java?Simon Ritter
 

More from Simon Ritter (19)

Cloud Native Compiler
Cloud Native CompilerCloud Native Compiler
Cloud Native Compiler
 
Java On CRaC
Java On CRaCJava On CRaC
Java On CRaC
 
The Art of Java Type Patterns
The Art of Java Type PatternsThe Art of Java Type Patterns
The Art of Java Type Patterns
 
Java performance monitoring
Java performance monitoringJava performance monitoring
Java performance monitoring
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
 
Building a Better JVM
Building a Better JVMBuilding a Better JVM
Building a Better JVM
 
The Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologyThe Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans Technology
 
Developing Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologyDeveloping Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java Technology
 
Java Is Still Free
Java Is Still FreeJava Is Still Free
Java Is Still Free
 
JDK 9 Deep Dive
JDK 9 Deep DiveJDK 9 Deep Dive
JDK 9 Deep Dive
 
Java Support: What's changing
Java Support:  What's changingJava Support:  What's changing
Java Support: What's changing
 
JDK 9: Mission Accomplished. What Next For Java?
JDK 9: Mission Accomplished. What Next For Java?JDK 9: Mission Accomplished. What Next For Java?
JDK 9: Mission Accomplished. What Next For Java?
 
JDK 9: Migrating Applications
JDK 9: Migrating ApplicationsJDK 9: Migrating Applications
JDK 9: Migrating Applications
 
Building a Brain with Raspberry Pi and Zulu Embedded JVM
Building a Brain with Raspberry Pi and Zulu Embedded JVMBuilding a Brain with Raspberry Pi and Zulu Embedded JVM
Building a Brain with Raspberry Pi and Zulu Embedded JVM
 
It's Java, Jim, but not as we know it
It's Java, Jim, but not as we know itIt's Java, Jim, but not as we know it
It's Java, Jim, but not as we know it
 
Whats New For Developers In JDK 9
Whats New For Developers In JDK 9Whats New For Developers In JDK 9
Whats New For Developers In JDK 9
 
JDK 9: 55 New Features
JDK 9: 55 New FeaturesJDK 9: 55 New Features
JDK 9: 55 New Features
 
Streams: The Good, The Bad And The Ugly
Streams: The Good, The Bad And The UglyStreams: The Good, The Bad And The Ugly
Streams: The Good, The Bad And The Ugly
 
Is An Agile Standard Possible For Java?
Is An Agile Standard Possible For Java?Is An Agile Standard Possible For Java?
Is An Agile Standard Possible For Java?
 

Recently uploaded

BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 

Recently uploaded (20)

BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 

JDK 14 Lots of New Features

  • 1. © Copyright Azul Systems 2020 © Copyright Azul Systems 2015 @speakjava JDK 14: Lots of New Features Simon Ritter Deputy CTO, Azul Systems 1
  • 2. © Copyright Azul Systems 2020 OpenJDK: New Release Model  A new version of the JDK is released every six months – March and September – 2018: JDK 10 and 11, 2019: JDK 12 and 13 – Continuing this year with JDK 14 and JDK 15  OpenJDK development is more agile  Features are only included when ready 2
  • 3. © Copyright Azul Systems 2020 Incubators And Previews  Add new features to OpenJDK  Without making it standard  Time for feedback and changes (or removal)  Incubator modules (JEP 11)  API and tool changes  Started in JDK 9 with HTTP/2  Preview features (JEP 12)  Language and VM changes  Started in JDK 12 with switch expression 3
  • 4. © Copyright Azul Systems 2020 JDK 14: Big Features  Language level – JEP 359: Records (preview) – JEP 305: Pattern matching for instanceof (preview) – JEP 368: Text blocks (second preview)  API Changes – Record related changes – Foreign memory access API (incubator module) 4
  • 5. © Copyright Azul Systems 2020 Simple Java Data Class 5 class Point { private final double x; private final double y; public Point(double x, double y) { this.x = x; this.y = y; } public double getX() { return x; } public double getY() { return y; } }
  • 6. © Copyright Azul Systems 2020 Records (Preview) 6 record Point(double x, double y) { } record Range(double low, double high) { public Range { if (low > high) throw new IllegalArgumentException("Bad values"); } public String toString() { return "Point is (" + x + ", " + y + ")"; } }
  • 7. © Copyright Azul Systems 2020 Using instanceof 7 if (obj instanceof String) { String s = (String)obj; System.out.println(s.length()); }
  • 8. © Copyright Azul Systems 2020 Pattern Matching instanceof (Preview) 8 if (obj instanceof String s) { System.out.println(s.length()); } else { // Use of s not allowed here } if (obj instanceof String s && s.length() > 0) System.out.println(s.length()); // Compiler error if (obj instanceof String s || s.length() > 0) System.out.println(s.length());
  • 9. © Copyright Azul Systems 2020 Pattern Matching instanceof (Preview) if (!(o instanceof String s)) return; System.out.println(s.length());
  • 10. © Copyright Azul Systems 2020 Text Blocks (Second Preview)  Two new escape sequences String continuous = """This line will not contain a newline in the middle"""; String colours = """Red s greens blue s """;
  • 11. © Copyright Azul Systems 2020 Switch Expression  JEP 361: Switch Expressions (standard) – No more changes from the second preview (JDK 13) – Now a standard feature in JDK 14  No --enable-preview flag necessary  Included in the Java SE specification 11
  • 12. © Copyright Azul Systems 2020 Helpful NullPointerException  Who's never had an NullPointerException? 12 a.b.c.i = 99; Exception in thread "main" java.lang.NullPointerException at Prog.main(Prog.java:5) Exception in thread "main" java.lang.NullPointerException: Cannot read field "c" because "a.b" is null at Prog.main(Prog.java:5)
  • 13. © Copyright Azul Systems 2020 Other Feature JEPs  343: Packaging tool (incubator)  345: NUMA aware memory allocation for G1  349: Java Flight Recorder streaming events  352: Non-volatile mapped byte buffers  364/365: ZGC on Windows/macOS 13
  • 14. © Copyright Azul Systems 2020 Deprecation and Removal JEPs  363: Remove the CMS collector  362: Deprecate the Solaris and SPARC ports  366: Deprecate ParallelScavenge + SerialOld GC combo  367: Remove the Pack200 tools and API 14
  • 15. © Copyright Azul Systems 2020 API Changes
  • 16. © Copyright Azul Systems 2020 Foreign-Memory Access API  Alternative to parts of sun.misc.Unsafe and MappedByteBuffer – MemorySegment – MemoryAddress – MemoryLayout 16
  • 17. © Copyright Azul Systems 2020 Record Related APIs  Class  isRecord()  RecordComponent[] getRecordComponents()  java.lang.Record  java.lang.annotation.ElementType  RECORD_TYPE  java.lang.runtime  New package for records  ObjectMethods class with bootstrap()  javax.lang.mode.util new classes 17
  • 18. © Copyright Azul Systems 2020 Serial Annotation  Used for compiler checks of Serializable classes  Use with these methods  writeObject  readObject  readObjectNoData  writeReplace  readResolve  And these fields  serialPersistentFields  serialVersionUID 18
  • 19. © Copyright Azul Systems 2020 Miscellaneous  NullPointerException  Now overrides getMessage() from Throwable  StrictMath  New exact methods: incrementExact(), decrementExact(), negateExact()  CompactNumberFormat  pluralRules()  HashSet  toArray() 19
  • 20. © Copyright Azul Systems 2020 Azul's Zulu Java
  • 21. © Copyright Azul Systems 2020 Zulu Community  Azul’s FREE binary distribution of OpenJDK  Passes all TCK tests  Versions: JDK 6-14 available  JDK 15 available as Early Access  Wide platform support:  Intel 64-bit Windows, Mac, Linux  Intel 32-bit Windows and Linux  ARM 32 and 64-bit  PPC 32 and 64-bit  Solaris 10/11 on SPARC 21 www.azul.com/downloads/zulu
  • 22. © Copyright Azul Systems 2020 Zulu Enterprise  Backporting of bug fixes and security patches from supported OpenJDK release  Zulu 8 supported until end of 2030  Zulu 6 supported until end of 2021  LTS releases have 8 years active + 2 years passive support  Medium Term Support releases – Two interim releases between LTS releases (13, 15...) – Bridge to LTS releases – Supported until 18 months after next LTS release 22
  • 23. © Copyright Azul Systems 2020 Summary
  • 24. © Copyright Azul Systems 2020 JDK 14: A Great Release  Powerful new language features – Records – Pattern matching for instanceof  Better NullPointerException messages  Useful API changes – Foreign memory access API  Keeping Java fresh after 25 years! 24
  • 25. © Copyright Azul Systems 2020 © Copyright Azul Systems 2015 @speakjava Thank You! Simon Ritter Deputy CTO, Azul Systems 25