SlideShare ist ein Scribd-Unternehmen logo
1 von 47
© Copyright Azul Systems 2017
© Copyright Azul Systems 2015
@speakjava
JDK 9, 10 and 11:
Pitfalls For The Unwary
Simon Ritter
Deputy CTO, Azul Systems
1
© Copyright Azul Systems 2017
JDK 9: Big And Small Changes
2
© Copyright Azul Systems 2017
JDK Compatibility
 Compatibility has always been very important
– Minor issues in JDK 1.4 and JDK 5
 Deprecation introduced in JDK 1.1
– JDK 8 has 492 deprecated API elements
– None had ever been removed
– At least one release warning of removal
 JDK 9 starts an overdue cleanup of the Java platform
– APIs and features removed
– Process will continue in future releases
© Copyright Azul Systems 2017
JDK 9 Onwards And Compatibility
4
Mark Reinhold
Chief Architect of the OpenJDK
© Copyright Azul Systems 2017
Migration Guidance From Oracle
5
"Clean applications that just depend on java.se
should just work" - Oracle Product Management
© Copyright Azul Systems 2017
Module System
© Copyright Azul Systems 2017
Java Platform Module System (JPMS)
 The core Java libraries are now a set of modules (JEP 220)
– 75 OpenJDK modules: 27 Java SE, 48 JDK
– Oracle JDK: 14 additional JDK, 8 JavaFX, 2 Oracle specific
 Most internal APIs now encapsulated (JEP 260)
– sun.misc.Unsafe
– Some can be used with command line options
7
© Copyright Azul Systems 2017
Migrating Applications to JPMS
 Initially, leave everything on the classpath
 Anything on the classpath is in the unnamed module
– All packages are exported
– The unnamed module depends on all modules
 Migrate to modules as required
– Try automatic modules
– Move existing jar files from classpath to modulepath
8
© Copyright Azul Systems 2017
Classpath v Modulepath
classpath
modulepath
Unnamed module
jar jar
jar
module-
info.class
jar
module-
info.class
jar
Automatic module
module-
info.class
© Copyright Azul Systems 2017
Reversing Encapsulation
 "The Big Kill Switch" to turn off encapsulation
– --illegal-access
 permit: Warning for first use of an encapsulated API
 warn: Warning for every use of an encapsulated API
 debug: Warning and stack trace for every use
 deny: No access to encapsulated APIs
10
© Copyright Azul Systems 2017
Reversing Encapsulation
 Allowing direct access to encapsulated APIs
– --add-exports
 Allowing reflective access to encapsulated APIs
– --add-opens
11
--add-exports java.management/com.sun.jmx.remote.internal=mytest
--add-exports java.management/sun.management=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
© Copyright Azul Systems 2017
Reversing Encapsulation
 Using the JAR file manifest
12
Add-Exports: java.base/sun.security.provider
© Copyright Azul Systems 2017
Finding Dependencies: jdeps
13
> jdeps --module-path /opt/javafx-sdk-11/lib
--add-modules=javafx.controls --list-deps FlightTracker.jar
JDK removed internal API/com.sun.media.jfxmediaimpl.platform.ios
java.base
java.datatransfer
java.desktop/java.awt.dnd.peer
java.desktop/sun.awt
java.desktop/sun.awt.dnd
java.desktop/sun.swing
java.logging
java.scripting
java.sql
java.xml
jdk.jsobject
jdk.unsupported
jdk.unsupported.desktop
jdk.xml.dom
© Copyright Azul Systems 2017
"Missing" Modules
 Remember, "Clean applications that only use java.se..."
 The java.se.ee module not included by default (JDK 9/10)
– Compilation and runtime
 Affected modules
– java.corba
– java.transaction
– java.activation
– java.xml.bind
– java.xml.ws
– java.xml.ws.annotation
14
© Copyright Azul Systems 2017
Using "Missing" Modules
 Use the command line option
– --add-modules java.corba
 All modules (except CORBA) have standalone versions
– Maven central
– Relevant JSR RI
 Deploy standalone version on the upgrade module path
– --upgrade-module-path <path>
 Deploy standalone version on the classpath
15
© Copyright Azul Systems 2017
Small Incompatibilities
© Copyright Azul Systems 2017
Milling Project Coin (JEP 213)
 A single underscore is now a keyword in Java
 Fear not, two or more underscores can still be used
17
error: as of release 9, '_' is a keyword, and may not be used as
an identifier
© Copyright Azul Systems 2017
Deleted Deprecated Methods
 Classes
– java.util.jar.Pack200
– java.util.jar.Unpack200
– java.util.logging.LogManager
 Methods
– addPropertyChangeListener()
– removePropertyChangeListener()
 Removal required for clean modularisation
18
© Copyright Azul Systems 2017
Deleted Deprecated Class
 com.sun.security.auth.callback.DialogCallbackHandle
r
 Part of the Java Authentication and Authorisation Service
– JAAS
– Deprecated in JDK 7
19
© Copyright Azul Systems 2017
Finding Deprecated API Use
 jdeprscan
– New tool in JDK 9
– Statically analyses class files and jar files against Java
SE APIs
– Looks for and reports usage of deprecated Java SE APIs
20
© Copyright Azul Systems 2017
JDK/JRE File Structure (JEP 220)
21
bin
Pre-JDK 9 JDK 9
lib
tools.jar
jre
bin
rt.jar
lib
libconfbin
jre directory
tools.jar
rt.jar
jmods
© Copyright Azul Systems 2017
New Version String Format (JEP 223)
 Old
– Download: Java SE 8u131
– Which has more patches, JDK 7u55 or JDK 7u60?
 New
– ${FEATURE}.${INTERIM}.${UPDATE}.${PATCH}
– Easy to understand by humans and apps
– Semantic versioning
22
$ java -version
java version "1.8.0_131"
© Copyright Azul Systems 2017
Non-Programmatic Issues
 Java Network Launch Protocol (JNLP) [JSR 52]
– Now uses strict parsing of configuration files
– Some files that did parse may now fail
 Extension mechanism/Endorsed Standards Override
mechanisms removed
– Directories removed
 $JAVA_HOME/lib/ext
 $JAVA_HOME/lib/endorsed
23
<JAVA_HOME>/lib/ext exists, extensions mechanism no longer
supported; Use -classpath instead.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
© Copyright Azul Systems 2017
Removed GC Options (JEP 214)
 Deprecated in JDK 8 (JEP 173)
24
DefNew + CMS : -XX:-UseParNewGC -XX:+UseConcMarkSweepGC
ParNew + SerialOld : -XX:+UseParNewGC
ParNew + iCMS : -Xincgc
ParNew + iCMS : -XX:+CMSIncrementalMode -XX:+UseConcMarkSweepGC
DefNew + iCMS : -XX:+CMSIncrementalMode -XX:+UseConcMarkSweepGC
-XX:-UseParNewGC
CMS foreground : -XX:+UseCMSCompactAtFullCollection
CMS foreground : -XX:+CMSFullGCsBeforeCompaction
CMS foreground : -XX:+UseCMSCollectionPassing
© Copyright Azul Systems 2017
JVM Logging
 Unified JVM logging (JEP 158)
– Common logging system for all components of JVM
 Unified GC logging (JEP 271)
– Re-implement GC logging using unified JVM logging
– Many command line options changed
25
© Copyright Azul Systems 2017
Removed JVM Flags: Ignored
26
 AdaptiveSizePausePolicy
 CodeCacheMinimumFreeSpace
 DefaultThreadPriority
 JNIDetachReleasesMonitors
 LazyBootClassLoader
 NmethodSweepCheckInterval
 NmethodSweepFraction
 PrintOopAddress
 ReflectionWrapResolutionErrors
 StarvationMonitorInterval
 ThreadSafetyMargin
 UseAltSigs
 UseBoundThreads
 UseCompilerSafepoints
 UseFastAccessorMethods
 UseFastEmptyMethods
 BackEdgeThreshold
 PreInflateSpin
Java HotSpot(TM) 64-Bit Server VM warning: Ignoring option
<Option>; support was removed in 9.0
© Copyright Azul Systems 2017
Replaced JVM Flags
27
© Copyright Azul Systems 2017
Deprecated JVM Flags
 Two forms of warning message
28
warning[gc] -XX:+PrintGC is deprecated. Will use -Xlog:gc instead.
Java HotSpot(TM) 64-Bit Server VM warning: Option
CreateMinidumpOnCrash was deprecated in version 9.0 and will likely
be removed in a future release. Use option CreateCoredumpOnCrash
instead.
© Copyright Azul Systems 2017
JVM Flags: Non-Starters
 50 command line flags from JDK 8
– Many related to incremental CMS
– Many for old-style logging
 -XX:+PrintHeapAtGC
 -XX:+TraceDynamicGCThreads, etc.
 Use will cause the JVM to abort at start
– It won't run your application
29
Unrecognized VM option '<Option>'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
© Copyright Azul Systems 2017
JDK 10
© Copyright Azul Systems 2017
Local Variable Type Inference
 var is now a reserved type
31
var var = new ArrayList<String>();
public class var {
public var(String x) {
...
}
}
© Copyright Azul Systems 2017
Deprecated Things Removed
 jdk.security.auth module
 com.sun.security.auth package
– PolicyFile
– SolarisNumericGroupPrincipal
– SolarisNumericUserPrincipal
– X500Principal
 com.sun.security.auth.module package
– SolarisLoginModule
– SolarisSystem
32
© Copyright Azul Systems 2017
Deprecated Things Removed
 java.lang.SecurityManager
 inCheck field
 Methods
– classDepth
– classLoaderDepth
– currentClassLoader
– currentLoadedClass
– getInCheck
– inClass
– inClassLoader
33
© Copyright Azul Systems 2017
Deprecated Things Removed
 java.lang.Runtime
 Obsolete internationalisation methods removed
– getLocalizedInputStream
– getLocalizedOutputStream
34
© Copyright Azul Systems 2017
Miscellaneous Things
 javah removed
– Use javac -h
 policytool removed
35
© Copyright Azul Systems 2017
Command Line Flags
 -d32 and -d64 no longer valid
– JVM will fail to start
 Also, 5 -X options
– -Xoss
– -Xsqnopause
– -Xoptimize
– -Xboundthreads
– -Xusealtsigs
36
© Copyright Azul Systems 2017
JDK 11
© Copyright Azul Systems 2017
Oracle JDK & OpenJDK
 Oracle now produce two binary JDK distributions
– Oracle JDK (now under commercial license)
– Oracle OpenJDK JDK (GPLv2 with CPE)
 All functional differences eliminated
– Significant changes that impact users switching to
OpenJDK builds
38
© Copyright Azul Systems 2017
Major Absent Features
 JavaFX
– Available via OpenJFX project and Gluon for binaries
 Browser plugin
– Is anyone still using this?
 Java Web Start
– This will hit some people
– No easy solution
 Oracle not open sourcing Web Start
 Some alternatives but no drop in replacement
39
© Copyright Azul Systems 2017
Tools Affected
40
 No more:
– appletviewer
– CORBA tools
 idlj
 orbd
 servertool
 tnamesrv
– Monitoring tool
 jmc (now standalone package)
– Java web service tools
 schemagen
 wsgen
 wsimport
 xjc
– Java deployment tools
 javapackager
 javaws
© Copyright Azul Systems 2017
APIs Removed
 java.se.ee aggregator module removed completely
 Others
 javax.security.auth.Policy
 java.lang.Runtime.runFinalizersOnExit
 java.lang.SecurityManager.checkAwtEventQueueAccess
 java.lang.SecurityManager.checkMemberAccess
 java.lang.SecurityManager.checkSystemClipboardAccess
 java.lang.SecurityManager.checkTopLevelWindow
 java.lang.System.runFinalizersOnExit
 java.lang.Thread.destroy
 java.lang.Thread.stop(java.lang.Throwable)
41
© Copyright Azul Systems 2017
Miscellaneous Things
 SNMP monitoring support
– jdk.snmp module removed
– JVM-MANAGEMENT-MIB.mib removed
 Desktop
– T2K font rasteriser removed
– Lucida fonts removed
 JDK now relies entirely on fonts from the operating system
 Security certificates
– Several root certificates removed from truststore
42
© Copyright Azul Systems 2017
Command Line -XX Flags
 Big changes
 JDK 9
– Removed 187, added 123
 JDK 10
– Removed 36, added 26
 JDK 11
– Removed 27, added 53
43
chriswhocodes.com/hotspot_option_differences.html
© Copyright Azul Systems 2017
Conclusions
© Copyright Azul Systems 2017
Migrating To JDK 9, 10 or 11
 Simple applications will run [almost] unchanged
– Leave everything on the classpath
– May need to change JVM flags
 Encapsulation
– Additional JVM flags
– Identify and rectify issues
 Smaller changes may cause issues
– Removed APIs
– JVM flag changes
45
© Copyright Azul Systems 2017
Zulu Java
 Azul’s binary distribution of OpenJDK
– Passes all TCK tests
 JDK 6, 7, 8, 9,10 and 11 available
 Wider platform support:
– Intel 32-bit Windows and Linux
– ARM 32 and 64-bit
– PowerPC
46
www.azul.com/downloads/zulu
© Copyright Azul Systems 2017
© Copyright Azul Systems 2015
@speakjava
Thank You!
Simon Ritter
Deputy CTO, Azul Systems
47

Weitere ähnliche Inhalte

Mehr von Simon Ritter

JDK 14 Lots of New Features
JDK 14 Lots of New FeaturesJDK 14 Lots of New Features
JDK 14 Lots of New FeaturesSimon Ritter
 
How to Choose a JDK
How to Choose a JDKHow to Choose a JDK
How to Choose a JDKSimon Ritter
 
The Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologyThe Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologySimon Ritter
 
Developing Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologyDeveloping Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologySimon Ritter
 
Is Java Still Free?
Is Java Still Free?Is Java Still Free?
Is Java Still Free?Simon Ritter
 
Moving Towards JDK 12
Moving Towards JDK 12Moving Towards JDK 12
Moving Towards JDK 12Simon Ritter
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondSimon Ritter
 
Java Is Still Free
Java Is Still FreeJava Is Still Free
Java Is Still FreeSimon Ritter
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondSimon Ritter
 
JDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep DiveJDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep DiveSimon Ritter
 
Java Support: What's changing
Java Support:  What's changingJava Support:  What's changing
Java Support: What's changingSimon Ritter
 
JDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for JavaJDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for JavaSimon Ritter
 
JDK 9: Mission Accomplished. What Next For Java?
JDK 9: Mission Accomplished. What Next For Java?JDK 9: Mission Accomplished. What Next For Java?
JDK 9: Mission Accomplished. What Next For Java?Simon Ritter
 
JDK 9: Migrating Applications
JDK 9: Migrating ApplicationsJDK 9: Migrating Applications
JDK 9: Migrating ApplicationsSimon Ritter
 
Building a Brain with Raspberry Pi and Zulu Embedded JVM
Building a Brain with Raspberry Pi and Zulu Embedded JVMBuilding a Brain with Raspberry Pi and Zulu Embedded JVM
Building a Brain with Raspberry Pi and Zulu Embedded JVMSimon Ritter
 
It's Java, Jim, but not as we know it
It's Java, Jim, but not as we know itIt's Java, Jim, but not as we know it
It's Java, Jim, but not as we know itSimon Ritter
 
Whats New For Developers In JDK 9
Whats New For Developers In JDK 9Whats New For Developers In JDK 9
Whats New For Developers In JDK 9Simon Ritter
 

Mehr von Simon Ritter (20)

JDK 14 Lots of New Features
JDK 14 Lots of New FeaturesJDK 14 Lots of New Features
JDK 14 Lots of New Features
 
Java after 8
Java after 8Java after 8
Java after 8
 
How to Choose a JDK
How to Choose a JDKHow to Choose a JDK
How to Choose a JDK
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
The Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans TechnologyThe Latest in Enterprise JavaBeans Technology
The Latest in Enterprise JavaBeans Technology
 
Developing Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java TechnologyDeveloping Enterprise Applications Using Java Technology
Developing Enterprise Applications Using Java Technology
 
Is Java Still Free?
Is Java Still Free?Is Java Still Free?
Is Java Still Free?
 
Moving Towards JDK 12
Moving Towards JDK 12Moving Towards JDK 12
Moving Towards JDK 12
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 
Java Is Still Free
Java Is Still FreeJava Is Still Free
Java Is Still Free
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 
JDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep DiveJDK 9 and JDK 10 Deep Dive
JDK 9 and JDK 10 Deep Dive
 
JDK 9 Deep Dive
JDK 9 Deep DiveJDK 9 Deep Dive
JDK 9 Deep Dive
 
Java Support: What's changing
Java Support:  What's changingJava Support:  What's changing
Java Support: What's changing
 
JDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for JavaJDK 9: The Start of a New Future for Java
JDK 9: The Start of a New Future for Java
 
JDK 9: Mission Accomplished. What Next For Java?
JDK 9: Mission Accomplished. What Next For Java?JDK 9: Mission Accomplished. What Next For Java?
JDK 9: Mission Accomplished. What Next For Java?
 
JDK 9: Migrating Applications
JDK 9: Migrating ApplicationsJDK 9: Migrating Applications
JDK 9: Migrating Applications
 
Building a Brain with Raspberry Pi and Zulu Embedded JVM
Building a Brain with Raspberry Pi and Zulu Embedded JVMBuilding a Brain with Raspberry Pi and Zulu Embedded JVM
Building a Brain with Raspberry Pi and Zulu Embedded JVM
 
It's Java, Jim, but not as we know it
It's Java, Jim, but not as we know itIt's Java, Jim, but not as we know it
It's Java, Jim, but not as we know it
 
Whats New For Developers In JDK 9
Whats New For Developers In JDK 9Whats New For Developers In JDK 9
Whats New For Developers In JDK 9
 

Kürzlich hochgeladen

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
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 GoalsJhone kinadey
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
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 PrecisionSolGuruz
 
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 ...OnePlan Solutions
 
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.pdfkalichargn70th171
 
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 ApplicationsAlberto González Trastoy
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
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...panagenda
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
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 CCTVshikhaohhpro
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 

Kürzlich hochgeladen (20)

(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
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
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
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
 
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 ...
 
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
 
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
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.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
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
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...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
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
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 

JDK 9, 10, 11: Pitfalls for the Unwary

  • 1. © Copyright Azul Systems 2017 © Copyright Azul Systems 2015 @speakjava JDK 9, 10 and 11: Pitfalls For The Unwary Simon Ritter Deputy CTO, Azul Systems 1
  • 2. © Copyright Azul Systems 2017 JDK 9: Big And Small Changes 2
  • 3. © Copyright Azul Systems 2017 JDK Compatibility  Compatibility has always been very important – Minor issues in JDK 1.4 and JDK 5  Deprecation introduced in JDK 1.1 – JDK 8 has 492 deprecated API elements – None had ever been removed – At least one release warning of removal  JDK 9 starts an overdue cleanup of the Java platform – APIs and features removed – Process will continue in future releases
  • 4. © Copyright Azul Systems 2017 JDK 9 Onwards And Compatibility 4 Mark Reinhold Chief Architect of the OpenJDK
  • 5. © Copyright Azul Systems 2017 Migration Guidance From Oracle 5 "Clean applications that just depend on java.se should just work" - Oracle Product Management
  • 6. © Copyright Azul Systems 2017 Module System
  • 7. © Copyright Azul Systems 2017 Java Platform Module System (JPMS)  The core Java libraries are now a set of modules (JEP 220) – 75 OpenJDK modules: 27 Java SE, 48 JDK – Oracle JDK: 14 additional JDK, 8 JavaFX, 2 Oracle specific  Most internal APIs now encapsulated (JEP 260) – sun.misc.Unsafe – Some can be used with command line options 7
  • 8. © Copyright Azul Systems 2017 Migrating Applications to JPMS  Initially, leave everything on the classpath  Anything on the classpath is in the unnamed module – All packages are exported – The unnamed module depends on all modules  Migrate to modules as required – Try automatic modules – Move existing jar files from classpath to modulepath 8
  • 9. © Copyright Azul Systems 2017 Classpath v Modulepath classpath modulepath Unnamed module jar jar jar module- info.class jar module- info.class jar Automatic module module- info.class
  • 10. © Copyright Azul Systems 2017 Reversing Encapsulation  "The Big Kill Switch" to turn off encapsulation – --illegal-access  permit: Warning for first use of an encapsulated API  warn: Warning for every use of an encapsulated API  debug: Warning and stack trace for every use  deny: No access to encapsulated APIs 10
  • 11. © Copyright Azul Systems 2017 Reversing Encapsulation  Allowing direct access to encapsulated APIs – --add-exports  Allowing reflective access to encapsulated APIs – --add-opens 11 --add-exports java.management/com.sun.jmx.remote.internal=mytest --add-exports java.management/sun.management=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED
  • 12. © Copyright Azul Systems 2017 Reversing Encapsulation  Using the JAR file manifest 12 Add-Exports: java.base/sun.security.provider
  • 13. © Copyright Azul Systems 2017 Finding Dependencies: jdeps 13 > jdeps --module-path /opt/javafx-sdk-11/lib --add-modules=javafx.controls --list-deps FlightTracker.jar JDK removed internal API/com.sun.media.jfxmediaimpl.platform.ios java.base java.datatransfer java.desktop/java.awt.dnd.peer java.desktop/sun.awt java.desktop/sun.awt.dnd java.desktop/sun.swing java.logging java.scripting java.sql java.xml jdk.jsobject jdk.unsupported jdk.unsupported.desktop jdk.xml.dom
  • 14. © Copyright Azul Systems 2017 "Missing" Modules  Remember, "Clean applications that only use java.se..."  The java.se.ee module not included by default (JDK 9/10) – Compilation and runtime  Affected modules – java.corba – java.transaction – java.activation – java.xml.bind – java.xml.ws – java.xml.ws.annotation 14
  • 15. © Copyright Azul Systems 2017 Using "Missing" Modules  Use the command line option – --add-modules java.corba  All modules (except CORBA) have standalone versions – Maven central – Relevant JSR RI  Deploy standalone version on the upgrade module path – --upgrade-module-path <path>  Deploy standalone version on the classpath 15
  • 16. © Copyright Azul Systems 2017 Small Incompatibilities
  • 17. © Copyright Azul Systems 2017 Milling Project Coin (JEP 213)  A single underscore is now a keyword in Java  Fear not, two or more underscores can still be used 17 error: as of release 9, '_' is a keyword, and may not be used as an identifier
  • 18. © Copyright Azul Systems 2017 Deleted Deprecated Methods  Classes – java.util.jar.Pack200 – java.util.jar.Unpack200 – java.util.logging.LogManager  Methods – addPropertyChangeListener() – removePropertyChangeListener()  Removal required for clean modularisation 18
  • 19. © Copyright Azul Systems 2017 Deleted Deprecated Class  com.sun.security.auth.callback.DialogCallbackHandle r  Part of the Java Authentication and Authorisation Service – JAAS – Deprecated in JDK 7 19
  • 20. © Copyright Azul Systems 2017 Finding Deprecated API Use  jdeprscan – New tool in JDK 9 – Statically analyses class files and jar files against Java SE APIs – Looks for and reports usage of deprecated Java SE APIs 20
  • 21. © Copyright Azul Systems 2017 JDK/JRE File Structure (JEP 220) 21 bin Pre-JDK 9 JDK 9 lib tools.jar jre bin rt.jar lib libconfbin jre directory tools.jar rt.jar jmods
  • 22. © Copyright Azul Systems 2017 New Version String Format (JEP 223)  Old – Download: Java SE 8u131 – Which has more patches, JDK 7u55 or JDK 7u60?  New – ${FEATURE}.${INTERIM}.${UPDATE}.${PATCH} – Easy to understand by humans and apps – Semantic versioning 22 $ java -version java version "1.8.0_131"
  • 23. © Copyright Azul Systems 2017 Non-Programmatic Issues  Java Network Launch Protocol (JNLP) [JSR 52] – Now uses strict parsing of configuration files – Some files that did parse may now fail  Extension mechanism/Endorsed Standards Override mechanisms removed – Directories removed  $JAVA_HOME/lib/ext  $JAVA_HOME/lib/endorsed 23 <JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; Use -classpath instead. Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
  • 24. © Copyright Azul Systems 2017 Removed GC Options (JEP 214)  Deprecated in JDK 8 (JEP 173) 24 DefNew + CMS : -XX:-UseParNewGC -XX:+UseConcMarkSweepGC ParNew + SerialOld : -XX:+UseParNewGC ParNew + iCMS : -Xincgc ParNew + iCMS : -XX:+CMSIncrementalMode -XX:+UseConcMarkSweepGC DefNew + iCMS : -XX:+CMSIncrementalMode -XX:+UseConcMarkSweepGC -XX:-UseParNewGC CMS foreground : -XX:+UseCMSCompactAtFullCollection CMS foreground : -XX:+CMSFullGCsBeforeCompaction CMS foreground : -XX:+UseCMSCollectionPassing
  • 25. © Copyright Azul Systems 2017 JVM Logging  Unified JVM logging (JEP 158) – Common logging system for all components of JVM  Unified GC logging (JEP 271) – Re-implement GC logging using unified JVM logging – Many command line options changed 25
  • 26. © Copyright Azul Systems 2017 Removed JVM Flags: Ignored 26  AdaptiveSizePausePolicy  CodeCacheMinimumFreeSpace  DefaultThreadPriority  JNIDetachReleasesMonitors  LazyBootClassLoader  NmethodSweepCheckInterval  NmethodSweepFraction  PrintOopAddress  ReflectionWrapResolutionErrors  StarvationMonitorInterval  ThreadSafetyMargin  UseAltSigs  UseBoundThreads  UseCompilerSafepoints  UseFastAccessorMethods  UseFastEmptyMethods  BackEdgeThreshold  PreInflateSpin Java HotSpot(TM) 64-Bit Server VM warning: Ignoring option <Option>; support was removed in 9.0
  • 27. © Copyright Azul Systems 2017 Replaced JVM Flags 27
  • 28. © Copyright Azul Systems 2017 Deprecated JVM Flags  Two forms of warning message 28 warning[gc] -XX:+PrintGC is deprecated. Will use -Xlog:gc instead. Java HotSpot(TM) 64-Bit Server VM warning: Option CreateMinidumpOnCrash was deprecated in version 9.0 and will likely be removed in a future release. Use option CreateCoredumpOnCrash instead.
  • 29. © Copyright Azul Systems 2017 JVM Flags: Non-Starters  50 command line flags from JDK 8 – Many related to incremental CMS – Many for old-style logging  -XX:+PrintHeapAtGC  -XX:+TraceDynamicGCThreads, etc.  Use will cause the JVM to abort at start – It won't run your application 29 Unrecognized VM option '<Option>' Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
  • 30. © Copyright Azul Systems 2017 JDK 10
  • 31. © Copyright Azul Systems 2017 Local Variable Type Inference  var is now a reserved type 31 var var = new ArrayList<String>(); public class var { public var(String x) { ... } }
  • 32. © Copyright Azul Systems 2017 Deprecated Things Removed  jdk.security.auth module  com.sun.security.auth package – PolicyFile – SolarisNumericGroupPrincipal – SolarisNumericUserPrincipal – X500Principal  com.sun.security.auth.module package – SolarisLoginModule – SolarisSystem 32
  • 33. © Copyright Azul Systems 2017 Deprecated Things Removed  java.lang.SecurityManager  inCheck field  Methods – classDepth – classLoaderDepth – currentClassLoader – currentLoadedClass – getInCheck – inClass – inClassLoader 33
  • 34. © Copyright Azul Systems 2017 Deprecated Things Removed  java.lang.Runtime  Obsolete internationalisation methods removed – getLocalizedInputStream – getLocalizedOutputStream 34
  • 35. © Copyright Azul Systems 2017 Miscellaneous Things  javah removed – Use javac -h  policytool removed 35
  • 36. © Copyright Azul Systems 2017 Command Line Flags  -d32 and -d64 no longer valid – JVM will fail to start  Also, 5 -X options – -Xoss – -Xsqnopause – -Xoptimize – -Xboundthreads – -Xusealtsigs 36
  • 37. © Copyright Azul Systems 2017 JDK 11
  • 38. © Copyright Azul Systems 2017 Oracle JDK & OpenJDK  Oracle now produce two binary JDK distributions – Oracle JDK (now under commercial license) – Oracle OpenJDK JDK (GPLv2 with CPE)  All functional differences eliminated – Significant changes that impact users switching to OpenJDK builds 38
  • 39. © Copyright Azul Systems 2017 Major Absent Features  JavaFX – Available via OpenJFX project and Gluon for binaries  Browser plugin – Is anyone still using this?  Java Web Start – This will hit some people – No easy solution  Oracle not open sourcing Web Start  Some alternatives but no drop in replacement 39
  • 40. © Copyright Azul Systems 2017 Tools Affected 40  No more: – appletviewer – CORBA tools  idlj  orbd  servertool  tnamesrv – Monitoring tool  jmc (now standalone package) – Java web service tools  schemagen  wsgen  wsimport  xjc – Java deployment tools  javapackager  javaws
  • 41. © Copyright Azul Systems 2017 APIs Removed  java.se.ee aggregator module removed completely  Others  javax.security.auth.Policy  java.lang.Runtime.runFinalizersOnExit  java.lang.SecurityManager.checkAwtEventQueueAccess  java.lang.SecurityManager.checkMemberAccess  java.lang.SecurityManager.checkSystemClipboardAccess  java.lang.SecurityManager.checkTopLevelWindow  java.lang.System.runFinalizersOnExit  java.lang.Thread.destroy  java.lang.Thread.stop(java.lang.Throwable) 41
  • 42. © Copyright Azul Systems 2017 Miscellaneous Things  SNMP monitoring support – jdk.snmp module removed – JVM-MANAGEMENT-MIB.mib removed  Desktop – T2K font rasteriser removed – Lucida fonts removed  JDK now relies entirely on fonts from the operating system  Security certificates – Several root certificates removed from truststore 42
  • 43. © Copyright Azul Systems 2017 Command Line -XX Flags  Big changes  JDK 9 – Removed 187, added 123  JDK 10 – Removed 36, added 26  JDK 11 – Removed 27, added 53 43 chriswhocodes.com/hotspot_option_differences.html
  • 44. © Copyright Azul Systems 2017 Conclusions
  • 45. © Copyright Azul Systems 2017 Migrating To JDK 9, 10 or 11  Simple applications will run [almost] unchanged – Leave everything on the classpath – May need to change JVM flags  Encapsulation – Additional JVM flags – Identify and rectify issues  Smaller changes may cause issues – Removed APIs – JVM flag changes 45
  • 46. © Copyright Azul Systems 2017 Zulu Java  Azul’s binary distribution of OpenJDK – Passes all TCK tests  JDK 6, 7, 8, 9,10 and 11 available  Wider platform support: – Intel 32-bit Windows and Linux – ARM 32 and 64-bit – PowerPC 46 www.azul.com/downloads/zulu
  • 47. © Copyright Azul Systems 2017 © Copyright Azul Systems 2015 @speakjava Thank You! Simon Ritter Deputy CTO, Azul Systems 47

Hinweis der Redaktion

  1. Segmented code cache to improve performance and allow future developments (Sumatra and the use of GPUs)