Slide 1

Slide 1 text

Stay on top of Java news from 8 to 21 Thiago Bomfim

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

Increase Development Productivity 01

Slide 4

Slide 4 text

JAVA LTS

Slide 5

Slide 5 text

JEP JDK Enhancement Proposal

Slide 6

Slide 6 text

String

Slide 7

Slide 7 text

String

Slide 8

Slide 8 text

String JEP 378: Text Blocks Java 15

Slide 9

Slide 9 text

String JEP 430: String Templates (Preview) Java 21

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 430: String Templates (Preview) Java 21

Slide 16

Slide 16 text

String JEP 430: String Templates (Preview) Java 21

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

Sealed Class 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

Sealed Class JEP 409: Sealed Classes Java 17

Slide 36

Slide 36 text

Sealed Class 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

No content

Slide 41

Slide 41 text

Records JEP 395: Records Java 16

Slide 42

Slide 42 text

Can we use Record for pattern matching?

Slide 43

Slide 43 text

Record Patterns JEP 440: Record Patterns Java 21

Slide 44

Slide 44 text

Record Patterns JEP 440: Record Patterns Java 21

Slide 45

Slide 45 text

Record Patterns

Slide 46

Slide 46 text

Record Patterns

Slide 47

Slide 47 text

Record Patterns

Slide 48

Slide 48 text

Record Patterns JEP 358: Helpful NullPointerExceptions Java 14

Slide 49

Slide 49 text

Record Patterns

Slide 50

Slide 50 text

Record Patterns JEP 440: Record Patterns Java 21

Slide 51

Slide 51 text

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

Slide 52

Slide 52 text

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

Slide 53

Slide 53 text

Record Patterns

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

Main

Slide 56

Slide 56 text

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

Slide 57

Slide 57 text

The goal of Project Amber is to explore and incubate smaller, productivity-oriented Java language feature. Project Amber ● 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

Slide 58

Slide 58 text

Performance and Garbage Collector 02

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

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

Slide 61

Slide 61 text

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

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

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

Slide 64

Slide 64 text

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

Slide 65

Slide 65 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 ● G1 continues to be improved, JEP 423: Region fix for G1, which may be available on Java 22 ● JDK-8272773 - Configurable Card Table Card Size (-XX:GCCardSizeInBytes) available on java 18

Slide 66

Slide 66 text

Epsilon ● No-Op GC ● No latency because there is no GC execution. However, there is constant memory consumption; ● JEP 318: Epsilon: A No-Op Garbage Collector (Experimental), available on Java 11 as Experimental

Slide 67

Slide 67 text

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

Slide 68

Slide 68 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 69

Slide 69 text

No content

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

https://blogs.oracle.com/javamagazine/post/java-garbage-collectors-evolution

Slide 72

Slide 72 text

https://kstefanj.github.io/2021/11/24/gc-progress-8-17.html

Slide 73

Slide 73 text

https://kstefanj.github.io/2021/11/24/gc-progress-8-17.html

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

50 VUs 50 requests per second 30 s Duration

Slide 78

Slide 78 text

100 VUs 100 requests per second 30 s Duration

Slide 79

Slide 79 text

400 VUs 400 requests per second 30 s Duration

Slide 80

Slide 80 text

1000 VUs 1000 requests per second 30 s Duration

Slide 81

Slide 81 text

Frameworks and Future 03

Slide 82

Slide 82 text

No content

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

No content

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

Java 22 ● JEP 454: Foreign Function & Memory API ✔ ● JEP 423: Region Pinning for G1 ❓ ● JEP 447: Statements before super() (Preview) ❓ ● JEP 456: Unnamed Variables and Patterns ❓ ● JEP 461: Stream Gatherers (Preview) ❓

Slide 89

Slide 89 text

Java ?? ● JEP 460: Vector API (Seventh Incubator) ● JEP 455: Primitive types in Patterns, instanceof, and switch (Preview) ● JEP 459: String Templates (Second Preview) ● JEP 404: Generational Shenandoah (Experimental) ● JEP 401: Value Classes and Objects (Preview) ….

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

How to stay up to date with the news 04

Slide 92

Slide 92 text

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

Slide 93

Slide 93 text

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

Slide 94

Slide 94 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/21-relnote- issues.html

Slide 95

Slide 95 text

How to stay up to date? Follow by blog, where I’m posting about best practices, and also news from Java 😁 https://devjava.substack.com/

Slide 96

Slide 96 text

https://www.linkedin.com/in/thiagobfim/ https://github.com/ThiagoBfim Slides provided by Slidesgo