SlideShare a Scribd company logo
HeadtowardJava14andJava15
KUBOTAYuji
LINECorporation
LINEDeveloperMeetup#65
KUBOTAYuji(@sugarlife)
Kafkaplatformteam@LINE
JVMmania,IcedTeacommitter/OpenJDKAuthor
JavaOne2014/2016/2017,WEB+DB「DivetoJava」
https://www.slideshare.net/YujiKubota/
2
WhatIwilltalk
NewfeaturesandchangesavailablefromJava14/15
MainlyaboutJVMandtools
WhatIwillnottalk
Incompatibility
3
Disclaimer
I'vetestedthecontentsofthisdocumentbyJDK14.0.2andJDK15
(build32)whichareavailableon jdk.java.net asmuchaspossible,
butnotallofthemhavebeentested,sopleasedoanoperation
confirmationbeforeyouattempttomodifyyourcode.
IconfirmedtheJDKimplementationby hg.openjdk.java.net/jdk-
updates/jdk14u and jdk/jdk .
4
Java14
16JavaEnhancementProposals(JEP)
155Compatibility&SpecificationReviews(CSR)
Java15
14JavaEnhancementProposals(JEP)
127Compatibility&SpecificationReviews(CSR)
5
Language/APIchanges
Java14
305:PatternMatchingforinstanceof(Preview)
352:Non‑VolatileMappedByteBuffers
359:Records(Preview)
361:SwitchExpressions(Standard)
368:TextBlocks(SecondPreview)
370:Foreign‑MemoryAccessAPI(Incubator)
Java15
360:SealedClasses(Preview)
371:HiddenClasses
373:ReimplementtheLegacyDatagramSocketAPI
375:PatternMatchingforinstanceof(SecondPreview)
378:TextBlocks
383:Foreign‑MemoryAccessAPI(SecondIncubator)
384:Records(SecondPreview)
385:DeprecateRMIActivationforRemoval
6
305:PatternMatchingforinstanceof(Preview)
Before
if (obj instanceof Double) {
Double d = (Double) obj;
// Processing with d
}
After
if (obj instanceof Double d) {
// Processing with d
}
thesamewayon switch (Undetermineddate)
switch (obj) {
case Integer i:
// want to do when Integer
case Double d:
// want to do when Double
}
NofurtherchangeinJava15(SecondPreview). 7
359:Records(Preview)
Newtypetocarryadata(like@Value(Lombok))
public record TestRecord(String s, int i) {}
public record TestRecord(String s, int i) {
private final String s;
private final int i;
String s() { return s; }
int i() {return i;}
TestRecord(String s, int i) {
this.s = s;
this.i = i;
}
// toString(), equals(), hashCode()
}
8
368:TextBlocks(SecondPreview)
AddEscape  (linebreak), s (space)
var textblock = """
Duke is 
cute s
""";
var textblock = "Duke is cute ";
NofurtherchangeinJava15(Standard).
9
370:Foreign‑MemoryAccessAPI(Incubator)
383:Foreign‑MemoryAccessAPI(SecondIncubator)
non‑heap
allocateDirect :upto2G( Integer.MAX_VALUE )perobject
JavaNativeInterface:managememorybyyourself
Unsafe.allocateMemory() :potentialremovewithoutwarning
VarHandle intHandle = MemoryHandles.varHandle(int.class,
ByteOrder.nativeOrder());
try (MemorySegment segment = MemorySegment.allocateNative(100)) {
MemoryAddress base = segment.baseAddress();
for (int i = 0; i < 25; i++) {
intHandle.set(base.addOffset(i * 4), i);
}
}
--add-modules jdk.incubator.foreign
10
360:SealedClasses(Preview)
Newtypetorestrictwhichotherclasses/interfacesmay
extend/implementthem
public sealed class Shape
permits com.example.polar.Circle,
com.example.quad.Rectangle,
com.example.quad.simple.Square {...}
11
371:HiddenClasses
Protectdynamicclassesagainstunpredictableaccess
cannotfindbybytecodelinkageand Class::forName ,
Classloader::loadClass
Normalclasses
ClassLoader::defineClass
Hiddenclasses
MethodHandles.Lookup#defineHiddenClass(byte[]
bytes, boolean initialize,
MethodHandles.Lookup.ClassOption... options)
Generatesahiddenclassfromthebyte[]andreturnsa
lookup objectwithreflectiveaccess
This lookup objectistheonlywaytogetthehidden
Classobject
12
Others
Java14
373:ReimplementtheLegacyDatagramSocketAPI
ContinuingTasksfromJava13
352:Non‑VolatileMappedByteBuffers
ByteBufferforNVM:Non‑VolatileMemory
Java15
385:DeprecateRMIActivationforRemoval
Deperecate java.rmi.activation packageandrelated
class/interface
rmid toolwillemitawarningmessage
13
JVMbehaviorchanges(exceptGC)
Java14
358:HelpfulNullPointerExceptions
Java15
374:DisableandDeprecateBiasedLocking
14
358:HelpfulNullPointerExceptions
$ java Sample
Exception in thread "main" java.lang.NullPointerException
at Sample.main(Sample.java:4)
15
4: String name = person.getName().toUpperCase();
public class Sample {
public static void main(String... args){
Person person = new Person();
String name = person.getName().toUpperCase();
}
static class Person {
String name = null;
Person() {
}
String getName() {
return name;
}
}
}
16
4: String name = person[i][j][k] // <= Nullable * 4
.getPersonalInformation() // <= Nullable
.getName() // <= Nullable
.getFamilyName() // <= Nullable
.toUpperCase(); // <= Nullable
17
-XX:+ShowCodeDetailsInExceptionMessages
Exception in thread "main" java.lang.NullPointerException:
Cannot invoke "String.toUpperCase()" // When
because the return value of "Sample$Person.getName()" is null // What
$ java -XX:+ShowCodeDetailsInExceptionMessages Sample
Exception in thread "main" java.lang.NullPointerException: Cann
at Sample.main(Sample.java:4)
18
Case:localvariable
3: String[] names = null;
4: names[1].toLowerCase();
$ java -XX:+ShowCodeDetailsInExceptionMessages LocalStringArray
Exception in thread "main" java.lang.NullPointerException:
Cannot load from object array // When
because "<local1>" is null // What
at LocalStringArray.main(LocalStringArray.java:4)
$ javac -g LocalStringArray.java // Add all debugging information
$ java -XX:+ShowCodeDetailsInExceptionMessages LocalStringArray
Exception in thread "main" java.lang.NullPointerException:
Cannot load from object array // When
because "names" is null // What
at LocalStringArray.main(LocalStringArray.java:4)
19
Concerns
Concernsaboutaddingdebugginginfomartion
classfilesize
reverseengineering
ConcernsaboutHelpfullNPE
performance
20
374:DisableandDeprecateBiasedLocking
BiasedlockingwasintroducedtoHotSpotVMtoreduceoverhead
ofuncontentedlocking
java.util.Vector sinceJava1.0
java.util.Collections sinceJava1.2
java.util.concurrent sinceJava5(1.5)
-XX:-UseBiasedLocking
21
GarbageCollectorchanges
Java14
345:NUMA‑AwareMemoryAllocationforG1
363:RemovetheConcurrentMarkSweep(CMS)GarbageCollector
364:ZGConmacOS
365:ZGConWindows
366:DeprecatetheParallelScavenge+SerialOldGCCombination
Java15promotesthefollowingexperimentalcollectorsasstandardfeature.
377:ZGC:AScalableLow‑LatencyGarbageCollector
379:Shenandoah:ALow‑Pause‑TimeGarbageCollector
22
345:NUMA‑AwareMemoryAllocationforG1
NUMAandG1GC
-XX:+UseNUMA
23
363:RemovetheConcurrentMarkSweep(CMS)Garbage
Collector
Goodbye -XX:+UseConcMarkSweepGC
Ifyousetaboveoption,JVMwilllaunchwithDefaultGC
YoushouldspecifyGCalgorthimclearly
OpenJDK 64-Bit Server VM warning:
Ignoring option UseConcMarkSweepGC;
support was removed in 14.0
24
364:ZGConmacOS&JEP365:ZGConWindows
ZGC
ExperimentalfeatureforLinuxsinceJava11
ProductionfeaturesinceJava15(JEP377)
PorttomacOSandWindows
HBaseteamevaluatedZGCwithJava11
https://engineering.linecorp.com/ja/blog/run‑hbase‑on‑
jdk11/
25
366:DeprecatetheParallelScavenge+SerialOldGC
Combination
-XX:+UseParallelGC -XX:-UseParallelOldGC
26
Tools
Java14
343:PackagingTool(Incubator)
349:JFREventStreaming
27
343:PackagingTool(Incubator)
jpackage :ToolsforcreatingJavaapplicationinstallersonLinux,
MacandWindows
NeedtoinstallWiXtoolsforWindows
TheAPIsthistoolusesareincubator
Createcustomruntimeimagebyjlink‑>createinstallerby
jpackage‑>providesforusers
28
Basicusage
$ jpackage --name sample --input <directory_includes_jar> 
--main-jar sample.jar --main-class Sample
$ ls sample-*
sample-1.0.dmg
Withcustomruntimeimage:
# Show ependent modules
$ jdeps -summary Sample.class
Sample.class -> java.base
Sample.class -> java.desktop
# Create runtime image that consists only of dependent modules
$ jlink --add-modules java.base,java.desktop --output image
# Create installer with custom runtime image
$ jpackage --name sample --input <directory_includes_jar> 
--main-jar sample.jar --main-class Sample --runtime-image image
29
349:JFREventStreaming
CollecteventsfromlocalJavaprocess
import java.time.Duration;
import jdk.jfr.consumer.RecordingStream;
public class JFRSample {
public static void main(String... args) {
try (RecordingStream rs = new RecordingStream()) {
// Enable events JVM will collect periodically
rs.enable("jdk.CPULoad")
.withPeriod(Duration.ofSeconds(10));
// Registers consumer to perform on event matching a name
rs.onEvent("jdk.CPULoad", System.out::println);
// Nothing happens when you specify an uncollected event
rs.onEvent("jdk.SafepointCleanup", System.out::println);
rs.start();
}
}
}
30
$ java Sample
jdk.CPULoad {
startTime = 18:30:06.225
jvmUser = 1.96%
jvmSystem = 0.10%
machineTotal = 16.56%
}
jdk.CPULoad {
startTime = 18:30:07.239
jvmUser = 0.26%
jvmSystem = 0.03%
machineTotal = 16.60%
}
:
31
AvailableEvents
built‑in:matadata.xml
ThreadPark,JavaMonitor,ClassLoad,PromotionFailed,...
canimplementbyextending jdk.jfr.Event sinceJava9
AvailableConfigurations
default
profile
32
Useconfigurationinsteadofenablingeventsbyyourself
import jdk.jfr.Configuration;
import jdk.jfr.consumer.EventStream;
import jdk.jfr.consumer.RecordingStream;
public class JFRSample {
public static void main(String... args) throws Exception {
try (RecordingStream rs = new RecordingStream(
// Set "default" or "profile"
Configuration.getConfiguration("default"))) {
// Can register action on events JVM collects by "default"
rs.onEvent("jdk.CPULoad", System.out::println);
rs.start();
}
}
}
33
CollecteventsfromremoteJavaprocessviaRepository
-XX:FlightRecorderOptions=repository=/path/to
# Launch jshell with enabling JFR
$ jshell -J-XX:StartFlightRecording=maxage=15m,settings=default
Started recording 1.
:
# Check repository path of targeted Java process (jshell)
$ jcmd $(pgrep jshell) JFR.configure
14006:
Current configuration:
Repository path: /private/var/folders/wm/dz3pkjf11hb1mph16365hj1h0000gp/T/2020_
:
34
Openstreamwithrepositorypath
import java.io.IOException;
import java.nio.file.Path;
import jdk.jfr.consumer.EventStream;
public class JFRRemoteSample {
public static void main(String... args) throws IOException {
// Pass repository path via argument
try (EventStream es = EventStream
.openRepository(Path.of(args[0]))) {
// Method Profiling Sample event
es.onEvent("jdk.ExecutionSample", System.out::println);
es.start();
}
}
}
$ java JFRRemoteSample /private/(snip)/2020_05_14_18_57_15_15902
jdk.ExecutionSample {
startTime = 19:09:55.345
sampledThread = "JFR Periodic Tasks" (javaThreadId = 13)
state = "STATE_RUNNABLE"
stackTrace = [
jdk.jfr.internal.PlatformRecorder.periodicTask() line: 474
jdk.jfr.internal.PlatformRecorder.lambda$startDiskMonitor$1() line:
jdk.jfr.internal.PlatformRecorder$$Lambda$52.1546693040.run()
java.lang.Thread.run() line: 832
]
}
35
ConcernaboutJFRandOOME
LeakProfilercannotobtaininfromationduetoshutdown
Shouldset -XX:+HeapDumpOnOutOfMemoryError
36
Otherchanges
Java14
362:DeprecatetheSolarisandSPARCPorts
Java15
339:Edwards‑CurveDigitalSignatureAlgorithm(EdDSA)
372:RemovetheNashornJavaScriptEngine
381:RemovetheSolarisandSPARCPorts
37
HeadtowardJava14andJava15
KUBOTAYuji
LINECorporation
LINEDeveloperMeetup#65
38

More Related Content

PDF
Head toward Java 14 and Java 15
PDF
Flavors of Concurrency in Java
PDF
Preparing your code for Java 9
PDF
Python + GDB = Javaデバッガ
PPTX
What's new in Java 11
PDF
Java 9 preview
PDF
Groovy, Transforming Language
PDF
Highlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
Head toward Java 14 and Java 15
Flavors of Concurrency in Java
Preparing your code for Java 9
Python + GDB = Javaデバッガ
What's new in Java 11
Java 9 preview
Groovy, Transforming Language
Highlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz

What's hot (20)

PDF
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
PDF
Devoxx17 - Préparez-vous à la modularité selon Java 9
PDF
Java11 New Features
PDF
What's Expected in Java 7
PDF
OpenJDK-Zulu talk at JEEConf'14
PPTX
Js tacktalk team dev js testing performance
PDF
Java 10 New Features
PPTX
Java 9 Modularity and Project Jigsaw
PDF
おっぴろげJavaEE DevOps
PPTX
Java Bytecode For Discriminating Developers - GeeCON 2011
PPTX
Jenkins Evolutions - JEEConf 2012
PDF
5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Shoul...
PDF
Using Java from Ruby with JRuby IRB
PDF
Androidの本当にあった怖い話
PPTX
JRuby in Java Projects
PDF
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
PDF
Groovy And Grails JUG Padova
PDF
Jaoo Michael Neale 09
PPTX
Spring Framework Petclinic sample application
PPTX
It pro dev_birbilis_20101127_en
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Devoxx17 - Préparez-vous à la modularité selon Java 9
Java11 New Features
What's Expected in Java 7
OpenJDK-Zulu talk at JEEConf'14
Js tacktalk team dev js testing performance
Java 10 New Features
Java 9 Modularity and Project Jigsaw
おっぴろげJavaEE DevOps
Java Bytecode For Discriminating Developers - GeeCON 2011
Jenkins Evolutions - JEEConf 2012
5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Shoul...
Using Java from Ruby with JRuby IRB
Androidの本当にあった怖い話
JRuby in Java Projects
Devoxx UK 2013 Test-Driven Development with JavaEE 7, Arquillian and Embedded...
Groovy And Grails JUG Padova
Jaoo Michael Neale 09
Spring Framework Petclinic sample application
It pro dev_birbilis_20101127_en
Ad

Similar to Head toward Java 14 and Java 15 #LINE_DM (20)

PDF
Summary of JDK10 and What will come into JDK11
PDF
Java 40 versions_sgp
PDF
G1: To Infinity and Beyond
PDF
Summary of JDK10 and What will come into JDK11
PPTX
Java On Speed
PDF
JDKs 10 to 14 (and beyond)
PDF
The Diabolical Developer's Guide to Surviving Java 9
PPTX
DevNexus 2020: Discover Modern Java
PDF
Java10 and Java11 at JJUG CCC 2018 Spr
PPTX
JDK 23_ Released and Ready – What’s Inside_.pptx
PPTX
Modern Java Workshop
PPTX
New thing in JDK10 even that scala-er should know
PDF
What's new in Java 8
PDF
Java 8
PDF
JDK9 Features (Summary, 31/Jul/2015) #JJUG
PPTX
Java n-plus-1-incl-demo-slides
PDF
Владимир Иванов. Java 8 и JVM: что нового в HotSpot
PDF
Life beyond Java 8
PDF
JVM Under the Hood
PDF
What to expect from Java 9
Summary of JDK10 and What will come into JDK11
Java 40 versions_sgp
G1: To Infinity and Beyond
Summary of JDK10 and What will come into JDK11
Java On Speed
JDKs 10 to 14 (and beyond)
The Diabolical Developer's Guide to Surviving Java 9
DevNexus 2020: Discover Modern Java
Java10 and Java11 at JJUG CCC 2018 Spr
JDK 23_ Released and Ready – What’s Inside_.pptx
Modern Java Workshop
New thing in JDK10 even that scala-er should know
What's new in Java 8
Java 8
JDK9 Features (Summary, 31/Jul/2015) #JJUG
Java n-plus-1-incl-demo-slides
Владимир Иванов. Java 8 и JVM: что нового в HotSpot
Life beyond Java 8
JVM Under the Hood
What to expect from Java 9
Ad

More from Yuji Kubota (20)

PDF
Head toward Java 16 (Night Seminar Edition)
PDF
Head toward Java 15 and Java 16
PDF
オンライン会議と音声認識
PDF
Head toward Java 13 and Java 14 #jjug
PDF
Catch up Java 12 and Java 13
PDF
Migration Guide from Java 8 to Java 11 #jjug
PDF
Introduction to Java 11: Support and JVM Features #jjug
PDF
Java 10でぼくたちの生活はどう変わるの?
PPTX
Project Jigsaw #kanjava
PPTX
Java 9 and Future #jjug
PPTX
Secrets of Rock Star Developers (and How to Become One!) [CON7615] (Yuji KUBO...
PDF
Unified JVM Logging
PDF
Prepare for Java 9 #jjug
PDF
jcmd #javacasual
PDF
JavaOne 2016 Java SE Feedback #jjug #j1jp
PDF
OpenJDK コミュニティに参加してみよう #jjug
PDF
Garbage First Garbage Collection (G1 GC) #jjug_ccc #ccc_cd6
PDF
JavaOne 2015 JDK Update (Jigsaw) #j1jp
PDF
OpenJDK トラブルシューティング #javacasual
PDF
HeapStats @ Seasar Conference 2015 LT
Head toward Java 16 (Night Seminar Edition)
Head toward Java 15 and Java 16
オンライン会議と音声認識
Head toward Java 13 and Java 14 #jjug
Catch up Java 12 and Java 13
Migration Guide from Java 8 to Java 11 #jjug
Introduction to Java 11: Support and JVM Features #jjug
Java 10でぼくたちの生活はどう変わるの?
Project Jigsaw #kanjava
Java 9 and Future #jjug
Secrets of Rock Star Developers (and How to Become One!) [CON7615] (Yuji KUBO...
Unified JVM Logging
Prepare for Java 9 #jjug
jcmd #javacasual
JavaOne 2016 Java SE Feedback #jjug #j1jp
OpenJDK コミュニティに参加してみよう #jjug
Garbage First Garbage Collection (G1 GC) #jjug_ccc #ccc_cd6
JavaOne 2015 JDK Update (Jigsaw) #j1jp
OpenJDK トラブルシューティング #javacasual
HeapStats @ Seasar Conference 2015 LT

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Cloud computing and distributed systems.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Approach and Philosophy of On baking technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Electronic commerce courselecture one. Pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MIND Revenue Release Quarter 2 2025 Press Release
Understanding_Digital_Forensics_Presentation.pptx
cuic standard and advanced reporting.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Cloud computing and distributed systems.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Spectral efficient network and resource selection model in 5G networks
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Unlocking AI with Model Context Protocol (MCP)
Building Integrated photovoltaic BIPV_UPV.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Approach and Philosophy of On baking technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Head toward Java 14 and Java 15 #LINE_DM