SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
MAKING THE
MOVE TO
JAVA 17
ALEX MOTLEY
@alexsmotley
CINDY HIGH
@CTHigh
ABOUT US
Alex Motley
Alex is a software engineer at IBM leading the WebSphere Application
Server migration tools team. His team develops several migration tools to
help with a variety of modernization scenarios including WebSphere
traditional to Liberty, Java SE and EE versions, and on-premise to cloud.
He has almost a decade of experience working with Java EE and Java
application server technology. Alex enjoys hiking and skiing and lives in
Rochester, MN.
Cindy High
Cindy is a software engineer with IBM and is the WebSphere Application
Server migration tools architect focusing on application modernization and
configuration migration. She has worked over 20 years with Java EE and
application server technology. The tools we developed over the years for
WebSphere can help you migrate your applications easier! Cindy enjoys
biking and working on stained glass projects and lives in Raleigh, NC.
MAKING THE
MOVE TO
JAVA 17
WHY
MIGRATE?
WHY MIGRATE?
Lots of new features!
Feature Lists ( JDK 11, JDK 12, JDK 13,
JDK 14, JDK 15, JDK 16, JDK 17)
WHY MIGRATE? - NEW JAVA 11 FEATURES
§ var for local variables (JEP 286)
§ New methods in classes (Collection, etc) (JEP 269)
- List<String> myList = ArrayList<String>();
- myList.add(“Georgia”);
- myList.add(“Minnesota”);
- myList.add(“Texas”);
- myList = Collections.unmodifiableList(myList);
+ var myList = List.of(“Georgia”, “Minnesota”, “Texas”);
WHY MIGRATE? - NEW JAVA 17 FEATURES
Text Blocks (JEP 378)
- String output = "Now you can moren" +
- "easily write Stringsn" +
- "that span multiple lines.";
+ String output = """
+ Now you can more
+ easily write Strings
+ that span multiple lines.""";
WHY MIGRATE? - NEW JAVA 17 FEATURES
Helpful NullPointerExceptions (JEP 358)
- Exception in thread "main" java.lang.NullPointerException
- at ...
+ Exception in thread "main" java.lang.NullPointerException:
+ Cannot invoke "String.concat(String)" because "MyClass.coffee"
+ is null
+ at ...
WHY MIGRATE? - NEW JAVA 17 FEATURES
Records (JEP 395)
- public class Car {
- private final String color;
- private final String make;
- private final String model;
-
- public Car(String color, String make, String model) {
- this.color = color;
- this.make = make;
- this.model = model;
- }
-
- // Getters for color, make, model
- // equals, toString, and hashCode methods
- }
+ public record Car (String color, String make, String model) {}
WHY MIGRATE? - NEW JAVA 17 FEATURES
Switch enhancements (JEP 361, JEP 406)
- String result = "";
- switch (day) {
- case MONDAY:
- case TUESDAY:
- case WEDNESDAY:
- case THURSDAY:
- case FRIDAY:
- result = "Weekday";
- break;
- case SATURDAY:
- case SUNDAY:
- result = "Weekend";
- break;
- default:
- throw new IllegalStateException("Unknown day: " + day);
- }
+ var result = switch (day) {
+ case MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY -> "Weekday";
+ case SATURDAY, SUNDAY -> "Weekend";
+ default -> throw new IllegalStateException("Unknown day: " + day);
+ };
WHY MIGRATE? - NEW JAVA 17 FEATURES
§ instanceof Pattern Matching (JEP 394)
- if (sport instanceof Baseball) {
- Baseball baseball = (Baseball) sport;
- baseball.pitch();
- }
+ if (sport instanceof Baseball baseball) {
+ baseball.pitch();
+ }
WHY MIGRATE?
Security Related
Changes
¡ Crypto
¡ With Applet support removed,
Security Manager deprecated
for removal
¡ Strongly Encapsulated JDK
Internals (JEP 403)
¡ Sealed classes (JEP 409)
¡ Hidden classes (JEP 371)
WHY MIGRATE?
Library/tooling
developers need to
keep up
WHY MIGRATE?
…and of course: Java
8 and 11 will EOL
MAKING THE
MOVE TO
JAVA 17
WHAT IS MY
TARGET JAVA
VERSION?
JAVA TIMELINE
Java 11 (LTS)
Sept
2018
LTS: Long Term Support - Production
2016 2017 2018 2019 2021
2020 2022 2023 2024 2025
Java 9
Java 10
Java 12
Java 13
Java 14
Java 15
Java 16
Java 7
Sept
2021
Java 18
Java 19
Java 20
Sept
2023
Continuous testing with non-LTS releases
Java 17 (LTS) 2027
Java 21 (LTS)
Java 8 (LTS) 2026
MAKING THE
MOVE TO
JAVA 17
WHAT ARE THE
TOP MIGRATION
ISSUES FOR
JAVA 8/11 à JAVA
17+?
Top
Migration
Issues
Missing Libraries
Removed APIs
Modularity & Strong Encapsulation
Out-of-date Dependencies
java.activation
javax.activation
java.corba
javax.rmi
javax.rmi.CORBA
org.omg.CORBA
org.omg.CORBA_2_3
org.omg.CORBA_2_3.portable
...
org.omg.PortableServer
org.omg.PortableServer.*
org.omg.SendingContext
org.omg.stub.java.rmi
java.transaction
javax.transaction
java.xml.bind
javax.xml.bind
javax.xml.bind.annotation
javax.xml.bind.annotation.adapte
javax.xml.bind.attachment
javax.xml.bind.helpers
javax.xml.bind.util
java.xml.ws
javax.jws
javax.jws.soap
javax.xml.soap
javax.xml.ws
javax.xml.ws.handler
javax.xml.ws.handler.soap
javax.xml.ws.http
javax.xml.ws.soap
javax.xml.ws.spi
javax.xml.ws.spi.http
javax.xml.ws.wsaddressing
java.xml.ws.annotation
javax.annotation
Java 11+ (Java EE)
(Most problematic for us)
Option 1: Package your own dependencies
Option 2: Rely on the app server to provide them (Open Liberty with Java 11+)
JAX-B
JAX-WS Common Annotations
JTA
Corba
JAF
JAVA 11 +
Java Web Start
github.com/openjdk/nashorn
JavaFX
openwebstart.com
openjfx.io
JAVA 17 +
Nashorn JavaScript Engine
Java 11+: Java EE
(Checkout jakarta.ee)
Top
Migration
Issues
Missing Libraries
Removed APIs
Modularity & Strong Encapsulation
Out-of-date Dependencies
JAVA 11
§ com.sun.awt.AWTUtilities
§ com.sun.image.codec.jpeg.*
§ com.sun.java.browser.plugin2.DOM
§ com.sun.security.auth.callback.DialogCallbackHandler
§ com.sun.security.auth.module.SolarisLoginModule
§ com.sun.security.auth.module.SolarisSystem
§ com.sun.security.auth.PolicyFile
§ com.sun.security.auth.SolarisNumericGroupPrincipal
§ com.sun.security.auth.SolarisNumericUserPrincipal
§ com.sun.security.auth.SolarisPrincipal
§ com.sun.security.auth.X500Principal
Removed Packages/Classes
- com.sun.security.auth.SolarisNumericGroupPrincipal principal
+ com.sun.security.auth.UnixNumericGroupPrincipal principal
JAVA 11
§ com.sun.xml.internal.bind.*
§ java.awt.dnd.peer.*
§ java.awt.peer.*
§ javax.security.auth.Policy
§ sun.misc.BASE64Decoder
§ sun.misc.BASE64Encoder
§ sun.misc.Unsafe.defineClass
§ sun.plugin.dom.DOMObject
Removed Packages/Classes
- if(button.getPeer() != null) {
+ if(button.isDisplayable()) {
JAVA 11
§ java.lang.Runtime.getLocalizedInputStream(..)
§ java.lang.Runtime.getLocalizedOutputStream(..)
§ java.lang.Runtime.runFinalizersOnExit(..)
§ java.lang.SecurityManager.checkAwtEventQueueAccess()
§ java.lang.SecurityManager.checkMemberAccess(..)
§ java.lang.SecurityManager.checkSystemClipboardAccess()
§ java.lang.SecurityManager.checkTopLevelWindow(..)
§ java.lang.SecurityManager.classDepth(..)
§ java.lang.SecurityManager.classLoaderDepth()
§ java.lang.SecurityManager.currentClassLoader()
§ java.lang.SecurityManager.currentLoadedClass()
§ java.lang.SecurityManager.getInCheck()
§ java.lang.SecurityManager.inClass(..)
§ java.lang.SecurityManager.inClassLoader()
Removed Methods
- securityManager.checkAwtEventQueueAccess();
+ securityManager.checkPermission(permission);
JAVA 11
§ java.lang.System.runFinalizersOnExit(..)
§ java.lang.Thread.destroy()
§ java.lang.Thread.stop(java.lang.Throwable)
§ java.util.jar.Pack200.Packer.addPropertyChangeListener(..)
§ java.util.jar.Pack200.Packer.removePropertyChangeListener(..)
§ java.util.jar.Pack200.Unpacker.addPropertyChangeListener(..)
§ java.util.jar.Pack200.Unpacker.removePropertyChangeListener(..)
§ java.util.logging.LogManager.addPropertyChangeListener(..)
§ java.util.logging.LogManager.removePropertyChangeListener(..)
Removed Methods
“Finalizers are inherently problematic, and
their use can lead to performance issues,
deadlocks, hangs, and other problematic
behavior.” - JDK-8165641
JAVA 17
§ com.sun.awt.SecurityWarning
§ java.security.acl.*
§ java.util.jar.Pack200*
§ jdk.net.SocketFlow*
§ java.rmi.activation*
Removed Packages/Classes
§ java.management.rmi.RMIConnectorServer.CREDENTIAL_TYPES
Removed Constants
JAVA 17
§ java.io.FileInputStream.finalize()
§ java.io.FileOutputStream.finalize()
§ java.lang.Runtime.traceInstructions(boolean)
§ java.lang.Runtime.traceMethodCalls(boolean)
§ java.util.zip.ZipFile.finalize()
§ java.util.zip.Inflater.finalize()
§ java.util.zip.Deflater.finalize()
§ netscape.javascript.JSObject.getWindow(Applet)
§ sun.misc.Unsafe.defineAnonymousClass(Class<?> hostClass, byte[] data, Object[] cpPatches)
§ javax.net.ssl.SSLSession.getPeerCertificateChain()**
§ java.lang.thread.countStackFrames()**
Removed Methods
§ javax.tools.ToolProvider()
§ java.lang.invoke.ConstantBootstraps()
§ java.lang.relect.Modifier()
Removed Constructors
**APIs now throw UnsupportedOperationException
- javax.net.ssl.SSLSession.getPeerCerficateChain();
+ javax.net.ssl.SSLSession.getPeerCerficates();
Top
Migration
Issues
Missing Libraries
Removed APIs
Modularity & Strong Encapsulation
Out-of-date Dependencies
§ Breaks code into modules containing packages
§ Applications must declare dependency on modules for access
§ Disruptive for Java SE application migrations
Java Platform Module
System (JPMS)
§ Use JDeps or --illegal-access=warn|debug
Use find issues in your
application
§ Use --illegal-access=permit
If migrating to Java 11
§ --add-opens launcher option
§ Add-Opens jar Manifest Attribute
If migrating to Java 17+
MODULARITY
Top
Migration
Issues
Missing Libraries
Removed APIs
Modularity & Strong Encapsulation
Out-of-date Dependencies
OUT-OF-DATE DEPENDENCIES
Libraries (ASM, Mockito, Spring, Spring Boot, etc)
Build Tools (Maven, Gradle, etc)
IDE (Eclipse, IntelliJ, VS Code, etc)
Application servers (Open Liberty, JBoss, WebLogic, etc)
My advice: take this time to upgrade your dependencies to the latest supported version. Setup automation tools.
MAKING THE
MOVE TO
JAVA 17
WHAT ABOUT
DEPRECATIONS?
KEEP AN EYE ON DEPRECATIONS
§ Java RMI Activation
§ Thread.destroy() and Thread.stop(Throwable t)
Some recently removed deprecations include:
§ Java Security Manager
§ Primitive wrapper class constructors
Some APIs currently deprecated for removal:
Full list: https://docs.oracle.com/en/java/javase/17/docs/api/deprecated-list.html#for-removal
MAKING THE
MOVE TO
JAVA 17
WHAT TOOLS CAN I
USE TO MAKE MY
MIGRATION
EASIER?
USE CONTAINERS
TO STAY UP TO
DATE
¡ Use containers to
easily keep your
Java versions up to
date
¡ This can be used to
ensure you stay up
to date with the
latest fix packs, as
well as test out
new Java versions
Application Binary
Scanner Tool
§ Download:
ibm.biz/WAMT4AppBi
naries or Maven
§ Command line tool
(free personal and
commercial use)
§ Scans an application
binary for migration
issues and produces a
report with identified
problems, solutions
and resource links
§ Documentation
JDeps
§ Command utility
shipped with JDK (run
with the target Java
version – Java 11+)
§ Migration Relevant
Option: -jdkinternals
§ Binary scanner will
recommend running
JDeps if it identifies
internal APIs
§ Documentation
Tools to automate
dependency updates
(various options)
§ Use an auto-upgrade
dependency tool to
keep your
dependencies up-to-
date
§ Configure the tools to
update based on
various settings
(frequency, etc)
§ Example: Dependabot
Eclipse Transformer
§ Transform application
binaries or source code
to use the new
package names in
Jakarta EE 9+
§ Documentation
TOOLS
DEMO
NEXT STEPS
Step 1
Evaluate your
applications
using the tools.
Step 2
Try running
your
application on
Java 17. If your
app runs
successfully,
you can skip the
next two steps.
Step 3
Debug and fix
your
application
code or build
files. Repeat
steps 1-3.
Step 4
Update your
dependencies
and tools as
needed.
Step 5
Run all your
application
tests.
Step 6
Celebrate!
HELPFUL LINKS
¡ Our blog on adding the Java 17 feature to the migration tools (written instructions on running binary
scanner): https://developer.ibm.com/tutorials/migration-to-java-11-made-easy/
¡ Binary Scanner and Eclipse IDE Plugin Source Scanner downloads: ibm.biz/wamtdownloads
§ Documentation: https://www.ibm.com/docs/wamt
¡ Link to the java17demo GitHub repo: https://github.com/alexsm82/java17demo
¡ Oracle Java SE Support Roadmap: https://www.oracle.com/java/technologies/java-se-support-
roadmap.html
¡ Java Version Almanac: https://javaalmanac.io/
¡ Andy Guibert’s blog on OpenLiberty Java 11+ support: https://openliberty.io/blog/2019/02/06/java-
11.html
¡ Blog on running the binary scanner with Maven:
https://community.ibm.com/community/user/wasdevops/blogs/alex-
motley1/2022/04/12/applications-pipelines-and-migrations
IBM SESSIONS
¡ Tuesday 10:00AM Fast JVM Startup with Checkpoint and Restore –
Tobi Ajila | JVM Platform
¡ Tuesday 2:15PM Better, Stronger, Faster Java in the Cloud - Jarek
Gawor and Tobi Ajila |Main Room (Java)
¡ 3:15 Book signing – Cloud Native Application Development with
MicroProfile and Open Liberty and Birthday Cake
¡ Wednesday 10:00AM Making the Move to Java 17 – Alex Motley and
Cindy High | Main Room (Java)
¡ Wednesday 1:15PM Relook at Microservices – Emily Jiang | Main Room
(Java)
QUESTIONS?
@alexsmotley
@CTHigh

Contenu connexe

Tendances

Tendances (20)

NGINX High-performance Caching
NGINX High-performance CachingNGINX High-performance Caching
NGINX High-performance Caching
 
Introduce yourself to java 17
Introduce yourself to java 17Introduce yourself to java 17
Introduce yourself to java 17
 
introduction to Vue.js 3
introduction to Vue.js 3 introduction to Vue.js 3
introduction to Vue.js 3
 
Integrating Splunk into your Spring Applications
Integrating Splunk into your Spring ApplicationsIntegrating Splunk into your Spring Applications
Integrating Splunk into your Spring Applications
 
Jenkins CI
Jenkins CIJenkins CI
Jenkins CI
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Introduction to Nginx
Introduction to NginxIntroduction to Nginx
Introduction to Nginx
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
Leveraging Nexus Repository Manager at the Heart of DevOps
Leveraging Nexus Repository Manager at the Heart of DevOpsLeveraging Nexus Repository Manager at the Heart of DevOps
Leveraging Nexus Repository Manager at the Heart of DevOps
 
Java 9 Features
Java 9 FeaturesJava 9 Features
Java 9 Features
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
Angular and The Case for RxJS
Angular and The Case for RxJSAngular and The Case for RxJS
Angular and The Case for RxJS
 
How and why to upgrade to java 16 or 17
How and why to upgrade to java 16 or 17How and why to upgrade to java 16 or 17
How and why to upgrade to java 16 or 17
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
NGINX: Basics and Best Practices
NGINX: Basics and Best PracticesNGINX: Basics and Best Practices
NGINX: Basics and Best Practices
 
AngularJS Directives
AngularJS DirectivesAngularJS Directives
AngularJS Directives
 
Vagrant
VagrantVagrant
Vagrant
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 

Similaire à Making The Move To Java 17 (JConf 2022)

Ten Man-Years of JavaFX: Real World Project Experiences
Ten Man-Years of JavaFX: Real World Project ExperiencesTen Man-Years of JavaFX: Real World Project Experiences
Ten Man-Years of JavaFX: Real World Project Experiences
Henrik Olsson
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with Scala
WO Community
 

Similaire à Making The Move To Java 17 (JConf 2022) (20)

Jet presentation
Jet presentationJet presentation
Jet presentation
 
Full Stack Scala
Full Stack ScalaFull Stack Scala
Full Stack Scala
 
JavaOne - The JavaFX Community and Ecosystem
JavaOne - The JavaFX Community and EcosystemJavaOne - The JavaFX Community and Ecosystem
JavaOne - The JavaFX Community and Ecosystem
 
Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8
 
Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments
 
Pre-Con Ed: Using Java to Access Your CA IDMS Databases and Applications
Pre-Con Ed: Using Java to Access Your CA IDMS Databases and ApplicationsPre-Con Ed: Using Java to Access Your CA IDMS Databases and Applications
Pre-Con Ed: Using Java to Access Your CA IDMS Databases and Applications
 
Scala Frustrations
Scala FrustrationsScala Frustrations
Scala Frustrations
 
Ten Man-Years of JavaFX: Real World Project Experiences
Ten Man-Years of JavaFX: Real World Project ExperiencesTen Man-Years of JavaFX: Real World Project Experiences
Ten Man-Years of JavaFX: Real World Project Experiences
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
 
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
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.js
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJS
 
Certifications Java
Certifications JavaCertifications Java
Certifications Java
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Building Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with ScalaBuilding Concurrent WebObjects applications with Scala
Building Concurrent WebObjects applications with Scala
 
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
 
Migrating Beyond Java 8
Migrating Beyond Java 8Migrating Beyond Java 8
Migrating Beyond Java 8
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build system
 
Java EE 6 & Spring: A Lover's Quarrel
Java EE 6 & Spring: A Lover's QuarrelJava EE 6 & Spring: A Lover's Quarrel
Java EE 6 & Spring: A Lover's Quarrel
 
Play framework
Play frameworkPlay framework
Play framework
 

Dernier

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Dernier (20)

Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 

Making The Move To Java 17 (JConf 2022)

  • 1. MAKING THE MOVE TO JAVA 17 ALEX MOTLEY @alexsmotley CINDY HIGH @CTHigh
  • 2. ABOUT US Alex Motley Alex is a software engineer at IBM leading the WebSphere Application Server migration tools team. His team develops several migration tools to help with a variety of modernization scenarios including WebSphere traditional to Liberty, Java SE and EE versions, and on-premise to cloud. He has almost a decade of experience working with Java EE and Java application server technology. Alex enjoys hiking and skiing and lives in Rochester, MN. Cindy High Cindy is a software engineer with IBM and is the WebSphere Application Server migration tools architect focusing on application modernization and configuration migration. She has worked over 20 years with Java EE and application server technology. The tools we developed over the years for WebSphere can help you migrate your applications easier! Cindy enjoys biking and working on stained glass projects and lives in Raleigh, NC.
  • 3. MAKING THE MOVE TO JAVA 17 WHY MIGRATE?
  • 4. WHY MIGRATE? Lots of new features! Feature Lists ( JDK 11, JDK 12, JDK 13, JDK 14, JDK 15, JDK 16, JDK 17)
  • 5. WHY MIGRATE? - NEW JAVA 11 FEATURES § var for local variables (JEP 286) § New methods in classes (Collection, etc) (JEP 269) - List<String> myList = ArrayList<String>(); - myList.add(“Georgia”); - myList.add(“Minnesota”); - myList.add(“Texas”); - myList = Collections.unmodifiableList(myList); + var myList = List.of(“Georgia”, “Minnesota”, “Texas”);
  • 6. WHY MIGRATE? - NEW JAVA 17 FEATURES Text Blocks (JEP 378) - String output = "Now you can moren" + - "easily write Stringsn" + - "that span multiple lines."; + String output = """ + Now you can more + easily write Strings + that span multiple lines.""";
  • 7. WHY MIGRATE? - NEW JAVA 17 FEATURES Helpful NullPointerExceptions (JEP 358) - Exception in thread "main" java.lang.NullPointerException - at ... + Exception in thread "main" java.lang.NullPointerException: + Cannot invoke "String.concat(String)" because "MyClass.coffee" + is null + at ...
  • 8. WHY MIGRATE? - NEW JAVA 17 FEATURES Records (JEP 395) - public class Car { - private final String color; - private final String make; - private final String model; - - public Car(String color, String make, String model) { - this.color = color; - this.make = make; - this.model = model; - } - - // Getters for color, make, model - // equals, toString, and hashCode methods - } + public record Car (String color, String make, String model) {}
  • 9. WHY MIGRATE? - NEW JAVA 17 FEATURES Switch enhancements (JEP 361, JEP 406) - String result = ""; - switch (day) { - case MONDAY: - case TUESDAY: - case WEDNESDAY: - case THURSDAY: - case FRIDAY: - result = "Weekday"; - break; - case SATURDAY: - case SUNDAY: - result = "Weekend"; - break; - default: - throw new IllegalStateException("Unknown day: " + day); - } + var result = switch (day) { + case MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY -> "Weekday"; + case SATURDAY, SUNDAY -> "Weekend"; + default -> throw new IllegalStateException("Unknown day: " + day); + };
  • 10. WHY MIGRATE? - NEW JAVA 17 FEATURES § instanceof Pattern Matching (JEP 394) - if (sport instanceof Baseball) { - Baseball baseball = (Baseball) sport; - baseball.pitch(); - } + if (sport instanceof Baseball baseball) { + baseball.pitch(); + }
  • 11. WHY MIGRATE? Security Related Changes ¡ Crypto ¡ With Applet support removed, Security Manager deprecated for removal ¡ Strongly Encapsulated JDK Internals (JEP 403) ¡ Sealed classes (JEP 409) ¡ Hidden classes (JEP 371)
  • 13. WHY MIGRATE? …and of course: Java 8 and 11 will EOL
  • 14. MAKING THE MOVE TO JAVA 17 WHAT IS MY TARGET JAVA VERSION?
  • 15. JAVA TIMELINE Java 11 (LTS) Sept 2018 LTS: Long Term Support - Production 2016 2017 2018 2019 2021 2020 2022 2023 2024 2025 Java 9 Java 10 Java 12 Java 13 Java 14 Java 15 Java 16 Java 7 Sept 2021 Java 18 Java 19 Java 20 Sept 2023 Continuous testing with non-LTS releases Java 17 (LTS) 2027 Java 21 (LTS) Java 8 (LTS) 2026
  • 16. MAKING THE MOVE TO JAVA 17 WHAT ARE THE TOP MIGRATION ISSUES FOR JAVA 8/11 à JAVA 17+?
  • 17. Top Migration Issues Missing Libraries Removed APIs Modularity & Strong Encapsulation Out-of-date Dependencies
  • 18. java.activation javax.activation java.corba javax.rmi javax.rmi.CORBA org.omg.CORBA org.omg.CORBA_2_3 org.omg.CORBA_2_3.portable ... org.omg.PortableServer org.omg.PortableServer.* org.omg.SendingContext org.omg.stub.java.rmi java.transaction javax.transaction java.xml.bind javax.xml.bind javax.xml.bind.annotation javax.xml.bind.annotation.adapte javax.xml.bind.attachment javax.xml.bind.helpers javax.xml.bind.util java.xml.ws javax.jws javax.jws.soap javax.xml.soap javax.xml.ws javax.xml.ws.handler javax.xml.ws.handler.soap javax.xml.ws.http javax.xml.ws.soap javax.xml.ws.spi javax.xml.ws.spi.http javax.xml.ws.wsaddressing java.xml.ws.annotation javax.annotation Java 11+ (Java EE) (Most problematic for us) Option 1: Package your own dependencies Option 2: Rely on the app server to provide them (Open Liberty with Java 11+) JAX-B JAX-WS Common Annotations JTA Corba JAF
  • 19. JAVA 11 + Java Web Start github.com/openjdk/nashorn JavaFX openwebstart.com openjfx.io JAVA 17 + Nashorn JavaScript Engine
  • 20. Java 11+: Java EE (Checkout jakarta.ee)
  • 21. Top Migration Issues Missing Libraries Removed APIs Modularity & Strong Encapsulation Out-of-date Dependencies
  • 22. JAVA 11 § com.sun.awt.AWTUtilities § com.sun.image.codec.jpeg.* § com.sun.java.browser.plugin2.DOM § com.sun.security.auth.callback.DialogCallbackHandler § com.sun.security.auth.module.SolarisLoginModule § com.sun.security.auth.module.SolarisSystem § com.sun.security.auth.PolicyFile § com.sun.security.auth.SolarisNumericGroupPrincipal § com.sun.security.auth.SolarisNumericUserPrincipal § com.sun.security.auth.SolarisPrincipal § com.sun.security.auth.X500Principal Removed Packages/Classes - com.sun.security.auth.SolarisNumericGroupPrincipal principal + com.sun.security.auth.UnixNumericGroupPrincipal principal
  • 23. JAVA 11 § com.sun.xml.internal.bind.* § java.awt.dnd.peer.* § java.awt.peer.* § javax.security.auth.Policy § sun.misc.BASE64Decoder § sun.misc.BASE64Encoder § sun.misc.Unsafe.defineClass § sun.plugin.dom.DOMObject Removed Packages/Classes - if(button.getPeer() != null) { + if(button.isDisplayable()) {
  • 24. JAVA 11 § java.lang.Runtime.getLocalizedInputStream(..) § java.lang.Runtime.getLocalizedOutputStream(..) § java.lang.Runtime.runFinalizersOnExit(..) § java.lang.SecurityManager.checkAwtEventQueueAccess() § java.lang.SecurityManager.checkMemberAccess(..) § java.lang.SecurityManager.checkSystemClipboardAccess() § java.lang.SecurityManager.checkTopLevelWindow(..) § java.lang.SecurityManager.classDepth(..) § java.lang.SecurityManager.classLoaderDepth() § java.lang.SecurityManager.currentClassLoader() § java.lang.SecurityManager.currentLoadedClass() § java.lang.SecurityManager.getInCheck() § java.lang.SecurityManager.inClass(..) § java.lang.SecurityManager.inClassLoader() Removed Methods - securityManager.checkAwtEventQueueAccess(); + securityManager.checkPermission(permission);
  • 25. JAVA 11 § java.lang.System.runFinalizersOnExit(..) § java.lang.Thread.destroy() § java.lang.Thread.stop(java.lang.Throwable) § java.util.jar.Pack200.Packer.addPropertyChangeListener(..) § java.util.jar.Pack200.Packer.removePropertyChangeListener(..) § java.util.jar.Pack200.Unpacker.addPropertyChangeListener(..) § java.util.jar.Pack200.Unpacker.removePropertyChangeListener(..) § java.util.logging.LogManager.addPropertyChangeListener(..) § java.util.logging.LogManager.removePropertyChangeListener(..) Removed Methods “Finalizers are inherently problematic, and their use can lead to performance issues, deadlocks, hangs, and other problematic behavior.” - JDK-8165641
  • 26. JAVA 17 § com.sun.awt.SecurityWarning § java.security.acl.* § java.util.jar.Pack200* § jdk.net.SocketFlow* § java.rmi.activation* Removed Packages/Classes § java.management.rmi.RMIConnectorServer.CREDENTIAL_TYPES Removed Constants
  • 27. JAVA 17 § java.io.FileInputStream.finalize() § java.io.FileOutputStream.finalize() § java.lang.Runtime.traceInstructions(boolean) § java.lang.Runtime.traceMethodCalls(boolean) § java.util.zip.ZipFile.finalize() § java.util.zip.Inflater.finalize() § java.util.zip.Deflater.finalize() § netscape.javascript.JSObject.getWindow(Applet) § sun.misc.Unsafe.defineAnonymousClass(Class<?> hostClass, byte[] data, Object[] cpPatches) § javax.net.ssl.SSLSession.getPeerCertificateChain()** § java.lang.thread.countStackFrames()** Removed Methods § javax.tools.ToolProvider() § java.lang.invoke.ConstantBootstraps() § java.lang.relect.Modifier() Removed Constructors **APIs now throw UnsupportedOperationException - javax.net.ssl.SSLSession.getPeerCerficateChain(); + javax.net.ssl.SSLSession.getPeerCerficates();
  • 28. Top Migration Issues Missing Libraries Removed APIs Modularity & Strong Encapsulation Out-of-date Dependencies
  • 29. § Breaks code into modules containing packages § Applications must declare dependency on modules for access § Disruptive for Java SE application migrations Java Platform Module System (JPMS) § Use JDeps or --illegal-access=warn|debug Use find issues in your application § Use --illegal-access=permit If migrating to Java 11 § --add-opens launcher option § Add-Opens jar Manifest Attribute If migrating to Java 17+ MODULARITY
  • 30. Top Migration Issues Missing Libraries Removed APIs Modularity & Strong Encapsulation Out-of-date Dependencies
  • 31. OUT-OF-DATE DEPENDENCIES Libraries (ASM, Mockito, Spring, Spring Boot, etc) Build Tools (Maven, Gradle, etc) IDE (Eclipse, IntelliJ, VS Code, etc) Application servers (Open Liberty, JBoss, WebLogic, etc) My advice: take this time to upgrade your dependencies to the latest supported version. Setup automation tools.
  • 32. MAKING THE MOVE TO JAVA 17 WHAT ABOUT DEPRECATIONS?
  • 33. KEEP AN EYE ON DEPRECATIONS § Java RMI Activation § Thread.destroy() and Thread.stop(Throwable t) Some recently removed deprecations include: § Java Security Manager § Primitive wrapper class constructors Some APIs currently deprecated for removal: Full list: https://docs.oracle.com/en/java/javase/17/docs/api/deprecated-list.html#for-removal
  • 34. MAKING THE MOVE TO JAVA 17 WHAT TOOLS CAN I USE TO MAKE MY MIGRATION EASIER?
  • 35. USE CONTAINERS TO STAY UP TO DATE ¡ Use containers to easily keep your Java versions up to date ¡ This can be used to ensure you stay up to date with the latest fix packs, as well as test out new Java versions
  • 36. Application Binary Scanner Tool § Download: ibm.biz/WAMT4AppBi naries or Maven § Command line tool (free personal and commercial use) § Scans an application binary for migration issues and produces a report with identified problems, solutions and resource links § Documentation JDeps § Command utility shipped with JDK (run with the target Java version – Java 11+) § Migration Relevant Option: -jdkinternals § Binary scanner will recommend running JDeps if it identifies internal APIs § Documentation Tools to automate dependency updates (various options) § Use an auto-upgrade dependency tool to keep your dependencies up-to- date § Configure the tools to update based on various settings (frequency, etc) § Example: Dependabot Eclipse Transformer § Transform application binaries or source code to use the new package names in Jakarta EE 9+ § Documentation TOOLS
  • 37. DEMO
  • 38. NEXT STEPS Step 1 Evaluate your applications using the tools. Step 2 Try running your application on Java 17. If your app runs successfully, you can skip the next two steps. Step 3 Debug and fix your application code or build files. Repeat steps 1-3. Step 4 Update your dependencies and tools as needed. Step 5 Run all your application tests. Step 6 Celebrate!
  • 39. HELPFUL LINKS ¡ Our blog on adding the Java 17 feature to the migration tools (written instructions on running binary scanner): https://developer.ibm.com/tutorials/migration-to-java-11-made-easy/ ¡ Binary Scanner and Eclipse IDE Plugin Source Scanner downloads: ibm.biz/wamtdownloads § Documentation: https://www.ibm.com/docs/wamt ¡ Link to the java17demo GitHub repo: https://github.com/alexsm82/java17demo ¡ Oracle Java SE Support Roadmap: https://www.oracle.com/java/technologies/java-se-support- roadmap.html ¡ Java Version Almanac: https://javaalmanac.io/ ¡ Andy Guibert’s blog on OpenLiberty Java 11+ support: https://openliberty.io/blog/2019/02/06/java- 11.html ¡ Blog on running the binary scanner with Maven: https://community.ibm.com/community/user/wasdevops/blogs/alex- motley1/2022/04/12/applications-pipelines-and-migrations
  • 40. IBM SESSIONS ¡ Tuesday 10:00AM Fast JVM Startup with Checkpoint and Restore – Tobi Ajila | JVM Platform ¡ Tuesday 2:15PM Better, Stronger, Faster Java in the Cloud - Jarek Gawor and Tobi Ajila |Main Room (Java) ¡ 3:15 Book signing – Cloud Native Application Development with MicroProfile and Open Liberty and Birthday Cake ¡ Wednesday 10:00AM Making the Move to Java 17 – Alex Motley and Cindy High | Main Room (Java) ¡ Wednesday 1:15PM Relook at Microservices – Emily Jiang | Main Room (Java)