SlideShare a Scribd company logo
Desde Java 8 hasta Java 17
Víctor Orozco - @tuxtor
5 de octubre de 2021
Nabenik
1
¿Como se hace Java?
De Java 8 hasta Java 17
Java 9
Java 10
Java 11
Java 12
Java 13
Java 14
Java 15
Java 16
Java 17
2
¿Como se hace Java?
¿Java?
• Lenguaje
• VM
• Bibliotecas/API
El conjunto es la plataforma Java (TM)
3
¿Como se actualiza Java?
• JCP - Java Community Process
• JSR - Java Specification Request
• JEP - Java Enhancement Proposal
• JCK - Java Compatibility Kit
4
¿Como se actualiza Java? - Java Enhancement Proposal
5
¿Como se actualiza Java? - Java Compatibility Kit
6
Distros
7
De Java 8 hasta Java 17
¿Que versión de Java se usa más en Guatemala?
Java 8
https://guatejug.github.io/jvm2021/
8
¿Que recibo con cada versión nueva de Java?
• Java - Lenguaje
• Java - Bibliotecas e APIs
• Java - Maquina Virtual de Java
Mejoras de tipo
• Incubation
• Preview (–flag)
• Definitiva
9
Java - Las mejoras que resaltan
• Java 9
• Modulos
• JShell
• HTTP/2
• Factory methods
• Java 10
• Type Inference
• Class Data Sharing
• Time based release
• Java 11
• String methods
• File methods
• Direct .java execution
• Java 12
• Switch expressions
• Java 13
• Text blocks
• Java 14
• Pattern matching
• Records
• Helpfull NPE
10
Java - Las mejoras que resaltan
• Java 15
• Sealed classes
• Nashorn removal
• SPARC/Solaris
removal
• Java 16
• Vector API (Incubator)
• C++ 14
• Records
• Java 17
• MacOS Metal
• Strong encapsulation
• Switch expression +
pattern matching
• AOT removal
• Applet deprecation
11
Java 9
JEP 222: jshell: The Java Shell (Read-Eval-Print Loop)
12
JEP 110: HTTP/2 Client
1 HttpRequest request = HttpRequest.newBuilder()
2 .uri(new URI("https://swapi.co/api/starships/9"))
3 .GET()
4 .build();
5
6 HttpResponse<String> response = HttpClient.newHttpClient()
7 .send(request, BodyHandlers.ofString());
8
9 System.out.println(response.body());
13
JEP 269: Convenience Factory Methods for Collections
Antes
1 Set<String> set = new HashSet<>();
2 set.add("a");
3 set.add("b");
4 set.add("c");
5 set = Collections.unmodifiableSet(set);
”Pro”
1 Set<String> set = Collections.unmodifiableSet(new HashSet<>(
Arrays.asList("a", "b", "c")));
Ahora
1 Set<String> set = Set.of("a", "b", "c");
14
JEP 213: Milling Project Coin - Private methods in interfaces
Antes
1 public interface Vehicle{
2 public void move();
3 }
Ahora
1 public interface Vehicle{
2 public default void makeNoise(){
3 System.out.println("Making noise!");
4 createNoise();
5 }
6
7 private void createNoise(){
8 System.out.println("Run run");
9 }
10 }
15
JEP 213: Milling Project Coin - Try-with-resources
Antes
1 BufferedReader reader = new BufferedReader(new FileReader("
langs.txt"));
2
3 try(BufferedReader innerReader = reader){
4 System.out.println(reader.readLine());
5 }
Ahora
1 BufferedReader reader = new BufferedReader(new FileReader("
langs.txt"));
2
3 try(reader){
4 System.out.println(reader.readLine());
5 } 16
Java 10
Java 10
286: Local-Variable Type Inference
296: Consolidate the JDK Forest into a Single Repository
304: Garbage-Collector Interface
307: Parallel Full GC for G1
310: Application Class-Data Sharing
312: Thread-Local Handshakes
313: Remove the Native-Header Generation Tool (javah)
314: Additional Unicode Language-Tag Extensions
316: Heap Allocation on Alternative Memory Devices
317: Experimental Java-Based JIT Compiler
319: Root Certificates
322: Time-Based Release Versioning
17
JEP 286: Local-Variable Type Inference
1 public static void main(String args[]){
2 var localValue = 99;
3 System.out.println(++localValue);
4 //localValue = "Foo"
5 }
18
JEP 310: Application Class-Data Sharing
1
java −XX:+UseAppCDS −XX : DumpLoadedClassList=classes . l s t − j a r demo−microservicio −
ee−microbundle . j a r
2
java −XX:+UseAppCDS −Xshare :dump −XX : SharedClassListFile =classes . l s t −XX :
SharedArchiveFile=app−cds . jsa demo−microservicio −ee−microbundle . j a r
3
java −XX:+UseAppCDS −Xshare : on −XX : SharedArchiveFile=app−cds . jsa − j a r demo−
microservicio −ee−microbundle . j a r
19
JEP 310: Application Class-Data Sharing
20
JEP 310: Application Class-Data Sharing
21
JEP 322: Time-Based Release Versioning
22
JEP 322: Time-Based Release Versioning
23
Java 11
Java 11
181: Nest-Based Access Control
309: Dynamic Class-File Constants
315: Improve Aarch64 Intrinsics
318: Epsilon: A No-Op Garbage Collector
320: Remove the Java EE and CORBA Modules
321: HTTP Client (Standard)
323: Local-Variable Syntax for Lambda
Parameters
324: Key Agreement with Curve25519 and
Curve448
327: Unicode 10
328: Flight Recorder
329: ChaCha20 and Poly1305 Cryptographic
Algorithms
330: Launch Single-File Source-Code Programs
331: Low-Overhead Heap Profiling
332: Transport Layer Security (TLS) 1.3
333: ZGC: A Scalable Low-Latency Garbage
Collector (Experimental)
335: Deprecate the Nashorn JavaScript Engine
336: Deprecate the Pack200 Tools and API
24
JEP 323: Local-Variable Syntax for Lambda Parameters
Antes
1 BiPredicate<String,String> demoPredicate =
2 (String a, String b) -> a.equals(b);
3 BiPredicate<String,String> demoPredicate =
4 (a, b) -> a.equals(b);
Ahora
1 BiPredicate<String,String> demoPredicate =
2 (var a, var b) -> a.equals(b);
Posibilidades
1 (@Nonnull var x, @Nullable var y) -> x.process(y)
25
JEP 330: Launch Single-File Source-Code Programs
26
Java 12
Java 12
189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
230: Microbenchmark Suite
325: Switch Expressions (Preview)
334: JVM Constants API
340: One AArch64 Port, Not Two
341: Default CDS Archives
344: Abortable Mixed Collections for G1
346: Promptly Return Unused Committed Memory from G1
27
325: Switch Expressions (Preview)
Antes
1 String langType = "";
2 switch (args[0]) {
3 case "Java":
4 case "Scala":
5 case "Kotlin":
6 langType = "Static typed";
7 break;
8 case "Groovy":
9 case "JavaScript":
10 langType = "Dynamic typed";
11 break;
12 }
13 System.out.println(langType);
28
325: Switch Expressions (Preview)
Ahora
1 String langType = switch (args[0]) {
2 case "Java", "Scala", "Kotlin" -> "Static typed";
3 case "Groovy", "JavaScript" -> "Dynamic typed";
4 default -> {
5 System.out.println("This meant to be a processing
block");
6 yield "Probably LISP :)";
7 }
8 };
9 System.out.println(langType);
29
Java 13
Java 13
350: Dynamic CDS Archives
351: ZGC: Uncommit Unused Memory
353: Reimplement the Legacy Socket API
354: Switch Expressions (Preview)
355: Text Blocks (Preview)
30
355: Text Blocks (Preview)
Antes
1 String html = "<html>n" +
2 " <body>n" +
3 " <p>Hello, world</p>n" +
4 " </body>n" +
5 "</html>n";
Ahora
1 String html = """
2 <html>
3 <body>
4 <p>Hello, world</p>
5 </body>
6 </html>
7 """; 31
Java 14
Java 14
305: Pattern Matching for instanceof (Preview)
343: Packaging Tool (Incubator)
345: NUMA-Aware Memory Allocation for G1
349: JFR Event Streaming
352: Non-Volatile Mapped Byte Buffers
358: Helpful NullPointerExceptions
359: Records (Preview)
361: Switch Expressions (Standard)
362: Deprecate the Solaris and SPARC Ports
363: Remove the Concurrent Mark Sweep (CMS)
Garbage Collector
364: ZGC on macOS
365: ZGC on Windows
366: Deprecate the ParallelScavenge + SerialOld
GC Combination
367: Remove the Pack200 Tools and API
368: Text Blocks (Second Preview)
370: Foreign-Memory Access API (Incubator)
32
JEP 359: Records (Preview)
Data carrier
1 record Person(String name, String email, int age) {}
Uso
1 Person foo = new Person("Marco", "example@mail.com",99);
2 System.out.println(foo);
3 //foo.name = "Polo";
33
305: Pattern Matching for instanceof (Preview)
Antes
1 if(o instanceof Person){
2 Person p = (Person)o;
3 System.out.println("Hello " + p.name());
4 }else{
5 System.out.println("Unknown object");
6 }
Ahora
1 if(o instanceof Person p){
2 System.out.println("Hello " + p.name());
3 }else{
4 System.out.println("Unknown object");
5 }
34
Java 15
Java 15
339: Addition of EdDSA (Edwards-Curve Digital
Signature Algorithm)
360: Preview for sealed classes
371: Addition of hidden classes in Java
372: Removal of the Nashorn JavaScript Engine
373: Legacy DatagramSocket API
reimplementation
374: Biased locking disablement and
deprecation
375: Second preview for instanceof pattern
matching
377: Addition of ZGC, the scalable, low-latency,
garbage collector for Java
378: Full inclusion of Java Text Blocks
379: Addition and enhancements of the
low-pause time Shenandoah garbage collector
381: Final remove of Solaris and SPARC Ports
383: Incubation of the Foreign-Memory Access
API
384: Second preview inclusion of Java Records
385: RMI Activation deprecation with the goal of
future removal
35
360: Sealed Classes (Preview)
Antes
1 public class Animal { ... }
2
3 public class Porsche extends Animal { ... }
Ahora
1 public abstract sealed class Animal
2 permits Dog, Cat, Wolf { ... }
36
360: Sealed Classes (Preview)
Antes
1 public class Animal { ... }
2
3 public class Porsche extends Animal { ... }
Pro
1 abstract sealed class Animal {
2 final class Dog extends Root { ... }
3 final class Cat extends Root { ... }
4 final class Wolf extends Root { ... }
5 ... }
37
371: Hidden Classes
Antes
1 ClassLoader::defineClass
Ahora
1 Lookup::defineHiddenClass
38
381: Remove the Solaris and SPARC Ports
39
383: Foreign-Memory Access API (Second Incubator)
1 VarHandle intHandle = MemoryHandles.varHandle(int.class,
2 ByteOrder.nativeOrder());
3
4 try (MemorySegment segment = MemorySegment.allocateNative(100)
) {
5 for (int i = 0; i < 25; i++) {
6 intHandle.set(segment, i * 4, i);
7 }
8 ...
40
Java 16
Java 16
338: Incubation of the Vector API
347: C++14 language features enablement
357: Migration from Mercurial to Git
369: GitHub migration of OpenJDK repositories
376: Concurrent thread-stack processing for
ZGC
380: Unix-Domain Socket Channels
386: Alpine Linux port
387: Support for elastic metaspace
388: The Windows AArch64 Port
389: Incubation of the Foreign Linker API
390: Value-based classes warnings
392: Addition of the Packaging Tool
393: Third incubation of the Foreign-Memory
Access API
394: Full inclusion of pattern matching for
instanceof
395: Full implementation of Java Records
396: Strongly encapsulation of JDK Internals
397: Second preview of sealed classes
41
386: Alpine Linux Port
42
389: Foreign Linker API (Incubator)
1 LibraryLookup libclang = LibraryLookup.ofLibrary("clang");
2 LibraryLookup.Symbol clangVersion = libclang.lookup("
clang_getClangVersion");
43
396: Strongly Encapsulate JDK Internals by Default
Antes
1 --illegal-access=permit
Ahora
1 --illegal-access=deny
44
Java 17
Java 17
306: Restoration of always-strict semantics for
floating-points
356: Pseudo-random number generators
improvements
382: Support for a new macOS pipeline for
rendering
391: The macOS AArch64 port
398: Deprecation of the infamous Applet API
with the goal of full removal
403: Strong encapsulation of Java’s internals
406: Switch pattern matching preview
407: RMI Activation removal
409: Full support for sealed Java classes
410: Removal of the experimental and largely
unused ahead-of-time (AOT) and just-in-time
(JIT) compilers
411: Deprecation of the Security Manager with
removal being the eventual goal
412: Incubation of the Foreign Function &
Memory API
414: Second incubation of the Vector API
415: Context-specific deserialization filters
45
406: Pattern Matching for switch (Preview)
1 static void testTriangle(Shape s) {
2 switch (s) {
3 case Triangle t && (t.calculateArea() > 100) ->
4 System.out.println("Large triangle");
5 case Square s ->
6 System.out.println("Is not a triangle is a square"
);
7 default ->
8 System.out.println("Non-triangle");
9 }
10 }
46
Nueva licencia Oracle Java 17
47
JEPs in JDK 17 integrated since JDK 11
https://openjdk.java.net/projects/jdk/17/jeps-since-jdk-11
48
Víctor Orozco
• vorozco@nabenik.com
• @tuxtor
• http://vorozco.com
• http://tuxtor.shekalug.org
This work is licensed under
Creative Commons Attribution-
NonCommercial-ShareAlike 3.0
Guatemala (CC BY-NC-SA 3.0 GT).
49

More Related Content

What's hot

スローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudy
スローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudyスローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudy
スローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudy
Yusuke Yamamoto
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
guest11106b
 

What's hot (20)

使ってみよう!JDK Flight Recorder
使ってみよう!JDK Flight Recorder使ってみよう!JDK Flight Recorder
使ってみよう!JDK Flight Recorder
 
JVM Under The Hood WDI.pdf
JVM Under The Hood WDI.pdfJVM Under The Hood WDI.pdf
JVM Under The Hood WDI.pdf
 
GraalVMのJavaネイティブビルド機能でどの程度起動が速くなるのか?~サーバレス基盤上での評価~ / How fast does GraalVM's...
GraalVMのJavaネイティブビルド機能でどの程度起動が速くなるのか?~サーバレス基盤上での評価~ / How fast does GraalVM's...GraalVMのJavaネイティブビルド機能でどの程度起動が速くなるのか?~サーバレス基盤上での評価~ / How fast does GraalVM's...
GraalVMのJavaネイティブビルド機能でどの程度起動が速くなるのか?~サーバレス基盤上での評価~ / How fast does GraalVM's...
 
Metaspace
MetaspaceMetaspace
Metaspace
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
 
Spring & hibernate
Spring & hibernateSpring & hibernate
Spring & hibernate
 
Spring Data JPAによるデータアクセス徹底入門 #jsug
Spring Data JPAによるデータアクセス徹底入門 #jsugSpring Data JPAによるデータアクセス徹底入門 #jsug
Spring Data JPAによるデータアクセス徹底入門 #jsug
 
KafkaとAWS Kinesisの比較
KafkaとAWS Kinesisの比較KafkaとAWS Kinesisの比較
KafkaとAWS Kinesisの比較
 
Spring annotation
Spring annotationSpring annotation
Spring annotation
 
Enabling Vectorized Engine in Apache Spark
Enabling Vectorized Engine in Apache SparkEnabling Vectorized Engine in Apache Spark
Enabling Vectorized Engine in Apache Spark
 
スローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudy
スローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudyスローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudy
スローダウン、ハングを一発解決 スレッドダンプはトラブルシューティングの味方 #wlstudy
 
为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)
 
Let's talk about Garbage Collection
Let's talk about Garbage CollectionLet's talk about Garbage Collection
Let's talk about Garbage Collection
 
Introduction to Java 11
Introduction to Java 11 Introduction to Java 11
Introduction to Java 11
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
 
スレッドダンプの読み方
スレッドダンプの読み方スレッドダンプの読み方
スレッドダンプの読み方
 
Java11 New Features
Java11 New FeaturesJava11 New Features
Java11 New Features
 
Spring GraphQL
Spring GraphQLSpring GraphQL
Spring GraphQL
 
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UIData Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
 
Graal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerGraal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT Compiler
 

Similar to De Java 8 a Java 17

Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...
IndicThreads
 

Similar to De Java 8 a Java 17 (20)

De Java 8 ate Java 14
De Java 8 ate Java 14De Java 8 ate Java 14
De Java 8 ate Java 14
 
De Java 8 a Java 11 y 14
De Java 8 a Java 11 y 14De Java 8 a Java 11 y 14
De Java 8 a Java 11 y 14
 
Welcome, Java 15! (Japanese)
Welcome, Java 15! (Japanese)Welcome, Java 15! (Japanese)
Welcome, Java 15! (Japanese)
 
Tracing the Breadcrumbs: Apache Spark Workload Diagnostics
Tracing the Breadcrumbs: Apache Spark Workload DiagnosticsTracing the Breadcrumbs: Apache Spark Workload Diagnostics
Tracing the Breadcrumbs: Apache Spark Workload Diagnostics
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern Java
 
Java 8 -12: da Oracle a Eclipse. Due anni e una rivoluzione
Java 8 -12: da Oracle a Eclipse. Due anni e una rivoluzioneJava 8 -12: da Oracle a Eclipse. Due anni e una rivoluzione
Java 8 -12: da Oracle a Eclipse. Due anni e una rivoluzione
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
Updates from Project Hydrogen: Unifying State-of-the-Art AI and Big Data in A...
Updates from Project Hydrogen: Unifying State-of-the-Art AI and Big Data in A...Updates from Project Hydrogen: Unifying State-of-the-Art AI and Big Data in A...
Updates from Project Hydrogen: Unifying State-of-the-Art AI and Big Data in A...
 
Relational Database Access with Python
Relational Database Access with PythonRelational Database Access with Python
Relational Database Access with Python
 
Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...Best Practices for performance evaluation and diagnosis of Java Applications ...
Best Practices for performance evaluation and diagnosis of Java Applications ...
 
Java
JavaJava
Java
 
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion MiddlewareAMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
 
Java On Speed
Java On SpeedJava On Speed
Java On Speed
 
Java 40 versions_sgp
Java 40 versions_sgpJava 40 versions_sgp
Java 40 versions_sgp
 
ClojureScript for the web
ClojureScript for the webClojureScript for the web
ClojureScript for the web
 
Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM  Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM
 
Java 9 new features
Java 9 new featuresJava 9 new features
Java 9 new features
 
Apache Flink internals
Apache Flink internalsApache Flink internals
Apache Flink internals
 
How Opera Syncs Tens of Millions of Browsers and Sleeps Well at Night
How Opera Syncs Tens of Millions of Browsers and Sleeps Well at NightHow Opera Syncs Tens of Millions of Browsers and Sleeps Well at Night
How Opera Syncs Tens of Millions of Browsers and Sleeps Well at Night
 

More from Víctor Leonel Orozco López

More from Víctor Leonel Orozco López (20)

Introducción al análisis de datos
Introducción al análisis de datosIntroducción al análisis de datos
Introducción al análisis de datos
 
From traditional to GitOps
From traditional to GitOpsFrom traditional to GitOps
From traditional to GitOps
 
Iniciando microservicios reales con JakartaEE/MicroProfile y arquetipos de Maven
Iniciando microservicios reales con JakartaEE/MicroProfile y arquetipos de MavenIniciando microservicios reales con JakartaEE/MicroProfile y arquetipos de Maven
Iniciando microservicios reales con JakartaEE/MicroProfile y arquetipos de Maven
 
Desde la TV, hasta la nube, el ecosistema de Java en 26 años
Desde la TV, hasta la nube, el ecosistema de Java en 26 añosDesde la TV, hasta la nube, el ecosistema de Java en 26 años
Desde la TV, hasta la nube, el ecosistema de Java en 26 años
 
Bootstraping real world Jakarta EE/MicroProfile microservices with Maven Arch...
Bootstraping real world Jakarta EE/MicroProfile microservices with Maven Arch...Bootstraping real world Jakarta EE/MicroProfile microservices with Maven Arch...
Bootstraping real world Jakarta EE/MicroProfile microservices with Maven Arch...
 
Tolerancia a fallas, service mesh y chassis
Tolerancia a fallas, service mesh y chassisTolerancia a fallas, service mesh y chassis
Tolerancia a fallas, service mesh y chassis
 
Explorando los objetos centrales de Kubernetes con Oracle Cloud
Explorando los objetos centrales de Kubernetes con Oracle CloudExplorando los objetos centrales de Kubernetes con Oracle Cloud
Explorando los objetos centrales de Kubernetes con Oracle Cloud
 
Introducción a GraalVM Native para aplicaciones JVM
Introducción a GraalVM Native para aplicaciones JVMIntroducción a GraalVM Native para aplicaciones JVM
Introducción a GraalVM Native para aplicaciones JVM
 
Desarrollo moderno con DevOps y Cloud Native
Desarrollo moderno con DevOps y Cloud NativeDesarrollo moderno con DevOps y Cloud Native
Desarrollo moderno con DevOps y Cloud Native
 
Design Patterns para Microsserviços com MicroProfile
 Design Patterns para Microsserviços com MicroProfile Design Patterns para Microsserviços com MicroProfile
Design Patterns para Microsserviços com MicroProfile
 
Gestión de proyectos con Maven
Gestión de proyectos con MavenGestión de proyectos con Maven
Gestión de proyectos con Maven
 
MicroProfile benefits for your monolithic applications
MicroProfile benefits for your monolithic applicationsMicroProfile benefits for your monolithic applications
MicroProfile benefits for your monolithic applications
 
Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...
Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...
Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...
 
Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...
Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...
Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...
 
Consejos y el camino del desarrollador de software
Consejos y el camino del desarrollador de softwareConsejos y el camino del desarrollador de software
Consejos y el camino del desarrollador de software
 
Seguridad de aplicaciones Java/JakartaEE con OWASP Top 10
Seguridad de aplicaciones Java/JakartaEE con OWASP Top 10Seguridad de aplicaciones Java/JakartaEE con OWASP Top 10
Seguridad de aplicaciones Java/JakartaEE con OWASP Top 10
 
Introducción a Kotlin para desarrolladores Java
Introducción a Kotlin para desarrolladores JavaIntroducción a Kotlin para desarrolladores Java
Introducción a Kotlin para desarrolladores Java
 
Programación con ECMA6 y TypeScript
Programación con ECMA6 y TypeScriptProgramación con ECMA6 y TypeScript
Programación con ECMA6 y TypeScript
 
Empaquetando aplicaciones Java con Docker y Kubernetes
Empaquetando aplicaciones Java con Docker y KubernetesEmpaquetando aplicaciones Java con Docker y Kubernetes
Empaquetando aplicaciones Java con Docker y Kubernetes
 
MicroProfile benefits for monolitic applications
MicroProfile benefits for monolitic applicationsMicroProfile benefits for monolitic applications
MicroProfile benefits for monolitic applications
 

Recently uploaded

Recently uploaded (20)

Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdf
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 

De Java 8 a Java 17

  • 1. Desde Java 8 hasta Java 17 Víctor Orozco - @tuxtor 5 de octubre de 2021 Nabenik 1
  • 2. ¿Como se hace Java? De Java 8 hasta Java 17 Java 9 Java 10 Java 11 Java 12 Java 13 Java 14 Java 15 Java 16 Java 17 2
  • 4. ¿Java? • Lenguaje • VM • Bibliotecas/API El conjunto es la plataforma Java (TM) 3
  • 5. ¿Como se actualiza Java? • JCP - Java Community Process • JSR - Java Specification Request • JEP - Java Enhancement Proposal • JCK - Java Compatibility Kit 4
  • 6. ¿Como se actualiza Java? - Java Enhancement Proposal 5
  • 7. ¿Como se actualiza Java? - Java Compatibility Kit 6
  • 9. De Java 8 hasta Java 17
  • 10. ¿Que versión de Java se usa más en Guatemala? Java 8 https://guatejug.github.io/jvm2021/ 8
  • 11. ¿Que recibo con cada versión nueva de Java? • Java - Lenguaje • Java - Bibliotecas e APIs • Java - Maquina Virtual de Java Mejoras de tipo • Incubation • Preview (–flag) • Definitiva 9
  • 12. Java - Las mejoras que resaltan • Java 9 • Modulos • JShell • HTTP/2 • Factory methods • Java 10 • Type Inference • Class Data Sharing • Time based release • Java 11 • String methods • File methods • Direct .java execution • Java 12 • Switch expressions • Java 13 • Text blocks • Java 14 • Pattern matching • Records • Helpfull NPE 10
  • 13. Java - Las mejoras que resaltan • Java 15 • Sealed classes • Nashorn removal • SPARC/Solaris removal • Java 16 • Vector API (Incubator) • C++ 14 • Records • Java 17 • MacOS Metal • Strong encapsulation • Switch expression + pattern matching • AOT removal • Applet deprecation 11
  • 15. JEP 222: jshell: The Java Shell (Read-Eval-Print Loop) 12
  • 16. JEP 110: HTTP/2 Client 1 HttpRequest request = HttpRequest.newBuilder() 2 .uri(new URI("https://swapi.co/api/starships/9")) 3 .GET() 4 .build(); 5 6 HttpResponse<String> response = HttpClient.newHttpClient() 7 .send(request, BodyHandlers.ofString()); 8 9 System.out.println(response.body()); 13
  • 17. JEP 269: Convenience Factory Methods for Collections Antes 1 Set<String> set = new HashSet<>(); 2 set.add("a"); 3 set.add("b"); 4 set.add("c"); 5 set = Collections.unmodifiableSet(set); ”Pro” 1 Set<String> set = Collections.unmodifiableSet(new HashSet<>( Arrays.asList("a", "b", "c"))); Ahora 1 Set<String> set = Set.of("a", "b", "c"); 14
  • 18. JEP 213: Milling Project Coin - Private methods in interfaces Antes 1 public interface Vehicle{ 2 public void move(); 3 } Ahora 1 public interface Vehicle{ 2 public default void makeNoise(){ 3 System.out.println("Making noise!"); 4 createNoise(); 5 } 6 7 private void createNoise(){ 8 System.out.println("Run run"); 9 } 10 } 15
  • 19. JEP 213: Milling Project Coin - Try-with-resources Antes 1 BufferedReader reader = new BufferedReader(new FileReader(" langs.txt")); 2 3 try(BufferedReader innerReader = reader){ 4 System.out.println(reader.readLine()); 5 } Ahora 1 BufferedReader reader = new BufferedReader(new FileReader(" langs.txt")); 2 3 try(reader){ 4 System.out.println(reader.readLine()); 5 } 16
  • 21. Java 10 286: Local-Variable Type Inference 296: Consolidate the JDK Forest into a Single Repository 304: Garbage-Collector Interface 307: Parallel Full GC for G1 310: Application Class-Data Sharing 312: Thread-Local Handshakes 313: Remove the Native-Header Generation Tool (javah) 314: Additional Unicode Language-Tag Extensions 316: Heap Allocation on Alternative Memory Devices 317: Experimental Java-Based JIT Compiler 319: Root Certificates 322: Time-Based Release Versioning 17
  • 22. JEP 286: Local-Variable Type Inference 1 public static void main(String args[]){ 2 var localValue = 99; 3 System.out.println(++localValue); 4 //localValue = "Foo" 5 } 18
  • 23. JEP 310: Application Class-Data Sharing 1 java −XX:+UseAppCDS −XX : DumpLoadedClassList=classes . l s t − j a r demo−microservicio − ee−microbundle . j a r 2 java −XX:+UseAppCDS −Xshare :dump −XX : SharedClassListFile =classes . l s t −XX : SharedArchiveFile=app−cds . jsa demo−microservicio −ee−microbundle . j a r 3 java −XX:+UseAppCDS −Xshare : on −XX : SharedArchiveFile=app−cds . jsa − j a r demo− microservicio −ee−microbundle . j a r 19
  • 24. JEP 310: Application Class-Data Sharing 20
  • 25. JEP 310: Application Class-Data Sharing 21
  • 26. JEP 322: Time-Based Release Versioning 22
  • 27. JEP 322: Time-Based Release Versioning 23
  • 29. Java 11 181: Nest-Based Access Control 309: Dynamic Class-File Constants 315: Improve Aarch64 Intrinsics 318: Epsilon: A No-Op Garbage Collector 320: Remove the Java EE and CORBA Modules 321: HTTP Client (Standard) 323: Local-Variable Syntax for Lambda Parameters 324: Key Agreement with Curve25519 and Curve448 327: Unicode 10 328: Flight Recorder 329: ChaCha20 and Poly1305 Cryptographic Algorithms 330: Launch Single-File Source-Code Programs 331: Low-Overhead Heap Profiling 332: Transport Layer Security (TLS) 1.3 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental) 335: Deprecate the Nashorn JavaScript Engine 336: Deprecate the Pack200 Tools and API 24
  • 30. JEP 323: Local-Variable Syntax for Lambda Parameters Antes 1 BiPredicate<String,String> demoPredicate = 2 (String a, String b) -> a.equals(b); 3 BiPredicate<String,String> demoPredicate = 4 (a, b) -> a.equals(b); Ahora 1 BiPredicate<String,String> demoPredicate = 2 (var a, var b) -> a.equals(b); Posibilidades 1 (@Nonnull var x, @Nullable var y) -> x.process(y) 25
  • 31. JEP 330: Launch Single-File Source-Code Programs 26
  • 33. Java 12 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental) 230: Microbenchmark Suite 325: Switch Expressions (Preview) 334: JVM Constants API 340: One AArch64 Port, Not Two 341: Default CDS Archives 344: Abortable Mixed Collections for G1 346: Promptly Return Unused Committed Memory from G1 27
  • 34. 325: Switch Expressions (Preview) Antes 1 String langType = ""; 2 switch (args[0]) { 3 case "Java": 4 case "Scala": 5 case "Kotlin": 6 langType = "Static typed"; 7 break; 8 case "Groovy": 9 case "JavaScript": 10 langType = "Dynamic typed"; 11 break; 12 } 13 System.out.println(langType); 28
  • 35. 325: Switch Expressions (Preview) Ahora 1 String langType = switch (args[0]) { 2 case "Java", "Scala", "Kotlin" -> "Static typed"; 3 case "Groovy", "JavaScript" -> "Dynamic typed"; 4 default -> { 5 System.out.println("This meant to be a processing block"); 6 yield "Probably LISP :)"; 7 } 8 }; 9 System.out.println(langType); 29
  • 37. Java 13 350: Dynamic CDS Archives 351: ZGC: Uncommit Unused Memory 353: Reimplement the Legacy Socket API 354: Switch Expressions (Preview) 355: Text Blocks (Preview) 30
  • 38. 355: Text Blocks (Preview) Antes 1 String html = "<html>n" + 2 " <body>n" + 3 " <p>Hello, world</p>n" + 4 " </body>n" + 5 "</html>n"; Ahora 1 String html = """ 2 <html> 3 <body> 4 <p>Hello, world</p> 5 </body> 6 </html> 7 """; 31
  • 40. Java 14 305: Pattern Matching for instanceof (Preview) 343: Packaging Tool (Incubator) 345: NUMA-Aware Memory Allocation for G1 349: JFR Event Streaming 352: Non-Volatile Mapped Byte Buffers 358: Helpful NullPointerExceptions 359: Records (Preview) 361: Switch Expressions (Standard) 362: Deprecate the Solaris and SPARC Ports 363: Remove the Concurrent Mark Sweep (CMS) Garbage Collector 364: ZGC on macOS 365: ZGC on Windows 366: Deprecate the ParallelScavenge + SerialOld GC Combination 367: Remove the Pack200 Tools and API 368: Text Blocks (Second Preview) 370: Foreign-Memory Access API (Incubator) 32
  • 41. JEP 359: Records (Preview) Data carrier 1 record Person(String name, String email, int age) {} Uso 1 Person foo = new Person("Marco", "example@mail.com",99); 2 System.out.println(foo); 3 //foo.name = "Polo"; 33
  • 42. 305: Pattern Matching for instanceof (Preview) Antes 1 if(o instanceof Person){ 2 Person p = (Person)o; 3 System.out.println("Hello " + p.name()); 4 }else{ 5 System.out.println("Unknown object"); 6 } Ahora 1 if(o instanceof Person p){ 2 System.out.println("Hello " + p.name()); 3 }else{ 4 System.out.println("Unknown object"); 5 } 34
  • 44. Java 15 339: Addition of EdDSA (Edwards-Curve Digital Signature Algorithm) 360: Preview for sealed classes 371: Addition of hidden classes in Java 372: Removal of the Nashorn JavaScript Engine 373: Legacy DatagramSocket API reimplementation 374: Biased locking disablement and deprecation 375: Second preview for instanceof pattern matching 377: Addition of ZGC, the scalable, low-latency, garbage collector for Java 378: Full inclusion of Java Text Blocks 379: Addition and enhancements of the low-pause time Shenandoah garbage collector 381: Final remove of Solaris and SPARC Ports 383: Incubation of the Foreign-Memory Access API 384: Second preview inclusion of Java Records 385: RMI Activation deprecation with the goal of future removal 35
  • 45. 360: Sealed Classes (Preview) Antes 1 public class Animal { ... } 2 3 public class Porsche extends Animal { ... } Ahora 1 public abstract sealed class Animal 2 permits Dog, Cat, Wolf { ... } 36
  • 46. 360: Sealed Classes (Preview) Antes 1 public class Animal { ... } 2 3 public class Porsche extends Animal { ... } Pro 1 abstract sealed class Animal { 2 final class Dog extends Root { ... } 3 final class Cat extends Root { ... } 4 final class Wolf extends Root { ... } 5 ... } 37
  • 47. 371: Hidden Classes Antes 1 ClassLoader::defineClass Ahora 1 Lookup::defineHiddenClass 38
  • 48. 381: Remove the Solaris and SPARC Ports 39
  • 49. 383: Foreign-Memory Access API (Second Incubator) 1 VarHandle intHandle = MemoryHandles.varHandle(int.class, 2 ByteOrder.nativeOrder()); 3 4 try (MemorySegment segment = MemorySegment.allocateNative(100) ) { 5 for (int i = 0; i < 25; i++) { 6 intHandle.set(segment, i * 4, i); 7 } 8 ... 40
  • 51. Java 16 338: Incubation of the Vector API 347: C++14 language features enablement 357: Migration from Mercurial to Git 369: GitHub migration of OpenJDK repositories 376: Concurrent thread-stack processing for ZGC 380: Unix-Domain Socket Channels 386: Alpine Linux port 387: Support for elastic metaspace 388: The Windows AArch64 Port 389: Incubation of the Foreign Linker API 390: Value-based classes warnings 392: Addition of the Packaging Tool 393: Third incubation of the Foreign-Memory Access API 394: Full inclusion of pattern matching for instanceof 395: Full implementation of Java Records 396: Strongly encapsulation of JDK Internals 397: Second preview of sealed classes 41
  • 52. 386: Alpine Linux Port 42
  • 53. 389: Foreign Linker API (Incubator) 1 LibraryLookup libclang = LibraryLookup.ofLibrary("clang"); 2 LibraryLookup.Symbol clangVersion = libclang.lookup(" clang_getClangVersion"); 43
  • 54. 396: Strongly Encapsulate JDK Internals by Default Antes 1 --illegal-access=permit Ahora 1 --illegal-access=deny 44
  • 56. Java 17 306: Restoration of always-strict semantics for floating-points 356: Pseudo-random number generators improvements 382: Support for a new macOS pipeline for rendering 391: The macOS AArch64 port 398: Deprecation of the infamous Applet API with the goal of full removal 403: Strong encapsulation of Java’s internals 406: Switch pattern matching preview 407: RMI Activation removal 409: Full support for sealed Java classes 410: Removal of the experimental and largely unused ahead-of-time (AOT) and just-in-time (JIT) compilers 411: Deprecation of the Security Manager with removal being the eventual goal 412: Incubation of the Foreign Function & Memory API 414: Second incubation of the Vector API 415: Context-specific deserialization filters 45
  • 57. 406: Pattern Matching for switch (Preview) 1 static void testTriangle(Shape s) { 2 switch (s) { 3 case Triangle t && (t.calculateArea() > 100) -> 4 System.out.println("Large triangle"); 5 case Square s -> 6 System.out.println("Is not a triangle is a square" ); 7 default -> 8 System.out.println("Non-triangle"); 9 } 10 } 46
  • 58. Nueva licencia Oracle Java 17 47
  • 59. JEPs in JDK 17 integrated since JDK 11 https://openjdk.java.net/projects/jdk/17/jeps-since-jdk-11 48
  • 60. Víctor Orozco • vorozco@nabenik.com • @tuxtor • http://vorozco.com • http://tuxtor.shekalug.org This work is licensed under Creative Commons Attribution- NonCommercial-ShareAlike 3.0 Guatemala (CC BY-NC-SA 3.0 GT). 49