Slide 1

Slide 1 text

Java 22 is born! And you are already outdated! Thiago Bomfim

Slide 2

Slide 2 text

Table of Contents Increase Development Productivity Performance and Garbage Collector Frameworks and Future How to stay up to date with the news 01 01 02 03 04

Slide 3

Slide 3 text

Increase Development Productivity 01

Slide 4

Slide 4 text

JEP - JDK Enhancement Proposal JEP is a document whose purpose is to add an enhancement to Java.

Slide 5

Slide 5 text

String

Slide 6

Slide 6 text

String

Slide 7

Slide 7 text

String JEP 378: Text Blocks Java 15

Slide 8

Slide 8 text

String JEP 430: String Templates (Preview) Java 21

Slide 9

Slide 9 text

String JEP 459: String Templates (Second Preview) Java 22

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

String

Slide 12

Slide 12 text

String

Slide 13

Slide 13 text

String

Slide 14

Slide 14 text

String JEP 378: Text Blocks Java 15

Slide 15

Slide 15 text

String JEP 459: String Templates (Second Preview) Java 22

Slide 16

Slide 16 text

String JEP 459: String Templates (Second Preview) Java 22

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

InstanceOf

Slide 19

Slide 19 text

InstanceOf

Slide 20

Slide 20 text

InstanceOf JEP 394: Pattern Matching for instanceof Java 16

Slide 21

Slide 21 text

InstanceOf JEP 441: Pattern Matching for switch Java 21

Slide 22

Slide 22 text

InstanceOf

Slide 23

Slide 23 text

InstanceOf Polymorphism

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

InstanceOf

Slide 26

Slide 26 text

InstanceOf

Slide 27

Slide 27 text

InstanceOf JEP 394: Pattern Matching for instanceof Java 16

Slide 28

Slide 28 text

InstanceOf JEP 441: Pattern Matching for switch Java 21

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

InstanceOf

Slide 33

Slide 33 text

InstanceOf JEP 409: Sealed Classes Java 17

Slide 34

Slide 34 text

InstanceOf JEP 441: Pattern Matching for switch Java 21

Slide 35

Slide 35 text

InstanceOf JEP 409: Sealed Classes Java 17

Slide 36

Slide 36 text

InstanceOf JEP 441: Pattern Matching for switch Java 21

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

Records

Slide 41

Slide 41 text

JEP 395: Records Java 16 Records

Slide 42

Slide 42 text

JEP 395: Records Java 16 Records JDK-8247444 Trust final fields in records

Slide 43

Slide 43 text

Can we use Record for pattern matching?

Slide 44

Slide 44 text

JEP 440: Record Patterns Java 21 Record Patterns

Slide 45

Slide 45 text

Record Patterns JEP 440: Record Patterns Java 21

Slide 46

Slide 46 text

Can we have a Record inside a Record?

Slide 47

Slide 47 text

Record Patterns

Slide 48

Slide 48 text

Record Patterns

Slide 49

Slide 49 text

Record Patterns JEP 358: Helpful NullPointerExceptions Java 14

Slide 50

Slide 50 text

Record Patterns

Slide 51

Slide 51 text

Record Patterns JEP 440: Record Patterns Java 21

Slide 52

Slide 52 text

JEP 286: Local-Variable Type Inference Java 10 Record Patterns

Slide 53

Slide 53 text

JEP 443: Unnamed Patterns and Variables (Preview) Java 21 Record Patterns

Slide 54

Slide 54 text

JEP 456: Unnamed Variables & Patterns Java 22 Record Patterns

Slide 55

Slide 55 text

Record Patterns

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

Main

Slide 58

Slide 58 text

JEP 445: Unnamed Classes and Instance Main Methods (Preview) Java 21 Main

Slide 59

Slide 59 text

JEP 463: Implicitly Declared Classes and Instance Main Methods (Second Preview) Java 22 Main

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

Collections

Slide 62

Slide 62 text

JEP 431: Sequenced Collections Java 21 Collections

Slide 63

Slide 63 text

Collections JEP 431: Sequenced Collections Java 21

Slide 64

Slide 64 text

No content

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

Stream

Slide 69

Slide 69 text

Stream JEP 461: Stream Gatherers (Preview) Java 22

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

Constructor

Slide 72

Slide 72 text

Constructor

Slide 73

Slide 73 text

JEP 447: Statements before super(...) (Preview) Java 22 Constructor

Slide 74

Slide 74 text

The goal of Project Amber is to explore and incubate smaller, productivity-oriented Java language feature. ● Pattern Matching for Switch ● Pattern Matching for Instanceof ● Unnamed Classes and Instance main methods ● Local-Variable Type Inference (var) ● Records ● Sealed Classes ● String Templates ● Text Blocks ● Switch Expressions ● Unnamed Patterns and Variables ● Statements before super(…) (Preview) Project Amber

Slide 75

Slide 75 text

Performance and Garbage Collector 02

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

A. 2 B. 3 C. 4 D. 5 E. > 5 F. Do we have more than one? How many GC are there ?

Slide 78

Slide 78 text

A. 2 B. 3 C. 4 D. 5 E. > 5 F. Do we have more than one? How many GC are there ?

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

Parallel GC ● Is the default until Java 9 ● Is more focused on throughput

Slide 81

Slide 81 text

CMS ● Was replaced by G1GC ● It was removed by JEP 363 - Remove the Concurrent Mark Sweep (CMS) Garbage Collector, after Java 14

Slide 82

Slide 82 text

G1 ● Is the default since Java 9 by JEP 248: Make G1 the Default Garbage Collector ● More focus on the balance between throughput and latency

Slide 83

Slide 83 text

G1 G1 continues to be improved: - JEP 423: Region fix for G1, on Java 22 - JDK-8272773 - Configurable Card Table Card Size (-XX:GCCardSizeInBytes) available on java 18

Slide 84

Slide 84 text

Shenandoah ● Lower latency GC ● JEP 379: Shenandoah: A Low-Pause-Time Garbage Collector (Production), available on Java 15 for production

Slide 85

Slide 85 text

ZGC ● Lower latency GC ● JEP 377: ZGC: A Scalable Low-Latency Garbage Collector (Production), available on Java 15 for production ● Improving in ZGC on Java 21 - JEP 439: Generational ZGC

Slide 86

Slide 86 text

Frameworks and Future 03

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

No content

Slide 92

Slide 92 text

Java 22 ● JEP 454: Foreign Function & Memory API ● JEP 457: Class-File API (Preview) ● JEP 458: Launch Multi-File Source-Code Programs ● JEP 460: Vector API (Seventh Incubator) ● JEP 462: Structured Concurrency (Second Preview) ● JEP 464: Scoped Values (Second Preview) …

Slide 93

Slide 93 text

Java 23 and Future ● JEP 455: Primitive types in Patterns, instanceof, and switch (Preview) ● JEP 404: Generational Shenandoah (Experimental) ● JEP 401: Value Classes and Objects (Preview) ● JEP 467: Markdown Documentation Comments ● JEP 468: Derived Record Creation (Preview)

Slide 94

Slide 94 text

No content

Slide 95

Slide 95 text

No content

Slide 96

Slide 96 text

How to stay up to date with the news 04

Slide 97

Slide 97 text

How to stay up to date? Follow the OpenJDK documentation: https://openjdk.org/projects/jdk/

Slide 98

Slide 98 text

How to stay up to date? Search more JEPS: https://chriswhocodes.com/jepsearch.html

Slide 99

Slide 99 text

How to stay up to date? Not all improvements are done by JEP, so you can follow the release notes from Oracle https://www.oracle.com/java/technologies/javase/22-relnote-is sues.html

Slide 100

Slide 100 text

How to stay up to date? Follow by blog, where I’m posting about best practices, and also more tips to help you improve your productivity with Java 😁 https://devjava.substack.com/

Slide 101

Slide 101 text

https://www.linkedin.com/in/thiagobfim/ https://github.com/ThiagoBfim Thank you!