From Java 11 to Java 17
From Java 11 to Java 17
Upgrade to Current Java LTS Version
About the Book
Spring 6 is released with requirement of JDK 17+. Upgrade to Java 17 to use Spring 6.
Java 17 is the next LTS version of Java. LTS means long-term support. Java 17 should be the next version to upgrade. It is expected that users of Java 11 will gradually migrate to Java 17.
This book covers major changes from Java 11 to Java 17. Below is a list of these features:
- Records
- Sealed classes
- Switch expressions
- Pattern matching
- Text blocks
- JFR event streaming, JVM constants API, hidden classes
- Changes to Java standard libraries
- New garbage collectors
- Changes to JVM
- Packaging tool - jpackage
- Foreign function & memory API
- Other changes
If you are using Java 11 and planning to upgrade to Java 17, this book can provide you with a valuable reference.
Table of Contents
-
1 Introduction
- 1.1 Java Releases Schedule After Java 9
-
1.2 JEPs in Different Java Releases
- 1.2.1 Java 12
- 1.2.2 Java 13
- 1.2.3 Java 14
- 1.2.4 Java 15
- 1.2.5 Java 16
- 1.2.6 Java 17
- 1.3 Install Java 17
- 1.4 Build Tools
- 1.5 Source Code
-
2 Records
- 2.1 Value Objects
-
2.2 Alternatives
- 2.2.1 Lombok
- 2.2.2 Kotlin Data Class
- 2.2.3 Scala Case Class
-
2.3 Use Records
- 2.3.1 Constructors
- 2.3.2 Nested Records
- 2.3.3 Local Records
- 2.3.4 Record class
-
3 Sealed Classes
- 3.1 Inheritance in Java
- 3.2 Sealed Classes
- 3.3 Sealed Interfaces
- 3.4 Sealed and Record Classes
- 3.5 Reflection API
- 3.6 Class File Changes
-
4 Switch Expressions
- 4.1 Problems with switch Statement
- 4.2 Switch Expression
- 4.3 Arrow Labels
-
5 Pattern Matching
-
5.1 Pattern Matching for
instanceof
-
5.2 Pattern Matching for
switch
-
5.1 Pattern Matching for
-
6 Text Blocks
- 6.1 Text Blocks
- 6.2 Re-indentation
- 6.3 Escape Sequences
- 6.4 New String Methods
-
7 Low-level APIs
-
7.1 JFR Event Streaming
- 7.1.1 Event Stream
- 7.1.2 Event
- 7.1.3 Example
-
7.2 JVM Constants API
- 7.2.1 Loadable Constants
- 7.2.2 Constants API
-
7.3 Hidden Classes
- 7.3.1 Names of Hidden Classes
- 7.3.2 Create Hidden Classes
- 7.3.3 Class Loading of Hidden Classes
- 7.3.4 Unloading of Hidden Classes
- 7.3.5 Stack Traces
- 7.3.6 Nest-based Access Control
-
7.1 JFR Event Streaming
-
8 Standard Libraries
- 8.1 Unix-Domain Socket Channels
- 8.2 Reimplement the Legacy Socket API
-
8.3 Reimplement the Legacy
DatagramSocket
API - 8.4 Enhanced Pseudo-Random Number Generators
- 8.5 New macOS Rendering Pipeline
- 8.6 Edwards-Curve Digital Signature Algorithm (EdDSA)
- 8.7 Context-Specific Deserialization Filters
-
9 JVM
- 9.1 Class-Data Sharing
- 9.2 Helpful NullPointExceptions
- 9.3 Elastic Metaspace
- 9.4 Deprecate and Disable Biased Locking
-
10 Packaging Tool
- 10.1 Use jpackage
-
10.2 Custom Runtime Image
- 10.2.1 Use jdeps
- 10.2.2 Use jlink
- 10.2.3 Create Package
-
11 Garbage Collectors
- 11.1 ZGC
- 11.2 Shenandoah
- 11.3 Deprecated GC
- 11.4 Removed GC
-
11.5 Updates to G1
- 11.5.1 Abortable Mixed Collections for G1
- 11.5.2 Promptly Return Unused Committed Memory from G1
- 11.5.3 NUMA-Aware Memory Allocation for G1
-
12 Foreign Function & Memory API
-
12.1 Foreign Memory
- 12.1.1 Memory Segments
- 12.1.2 Dereferencing Memory Segments
- 12.1.3 Memory Layouts
- 12.1.4 Resource Scopes
- 12.1.5 Cleaner
-
12.2 Foreign Functions
- 12.2.1 Downcall - Call from Java to Native
- 12.2.2 Upcall - Call From Native To Java
-
12.1 Foreign Memory
-
13 Deprecated & Removed Features
-
13.1 Deprecated Features
- 13.1.1 Applet API
- 13.1.2 Security Manager
-
13.2 Removed Features
- 13.2.1 Experimental AOT and JIT Compiler
- 13.2.2 RMI Activation
- 13.2.3 Pack200 Tools
- 13.2.4 Nashorn JavaScript Engine
- 13.2.5 Solaris and SPARC Ports
-
13.1 Deprecated Features
-
14 Misc.
- 14.1 Restore Always-Strict Floating-Point Semantics
- 14.2 macOS/AArch64 Port
- 14.3 Alpine Linux Port
- 14.4 Strongly Encapsulate JDK Internals
- 14.5 Migrate to GitHub
The Leanpub 60-day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them