SlideShare a Scribd company logo
1 of 67
Java 9 : New Features
07 juli 2016
Masudul Haque
Agenda
• Introduction
• Java 9 Milestones
• JEP & JSR
• Modularity/Project Jigshaw: A revolutionary enhancement
• Java shell/ REPL : Real Eval Print Loop
• New Collection API
• Small Changes
• Summary
• Q/A
(1995-2016)
Java in Numbers
• #1 Development Platform in the world
• 9 Millions Developers
• 800.000 Java Certifications
• 7 Billion devices run Java
• 1 Billion Java Downloads per Year
• 97% of Enterprise Desktops run Java
• 100% of Blu-ray Disc Players ship with Java
Java is in race
Java is in race: TIOBE index
Java is changing
Java is updating
Java 9 Milestones
Java 9: what is it
102: Process API Updates
110: HTTP 2 Client
143: Improve Contended Locking
158: Unified JVM Logging
165: Compiler Control
193: Variable Handles
197: Segmented Code Cache
199: Smart Java Compilation, Phase Two
200: The Modular JDK
201: Modular Source Code
211: Elide Deprecation Warnings on Import Statements
212: Resolve Lint and Doclint Warnings
213: Milling Project Coin
214: Remove GC Combinations Deprecated in JDK 8
215: Tiered Attribution for javac
216: Process Import Statements Correctly
217: Annotations Pipeline 2.0
219: Datagram Transport Layer Security (DTLS)
220: Modular Run-Time Images
221: Simplified Doclet API
222: jshell: The Java Shell (Read-Eval-Print Loop)
226: UTF-8 Property Files
227: Unicode 7.0
228: Add More Diagnostic Commands
231: Remove Launch-Time JRE Version Selection
232: Improve Secure Application Performance
233: Generate Run-Time Compiler Tests Automatically
235: Test Class-File Attributes Generated by javac
236: Parser API for Nashorn
237: Linux/AArch64 Port
240: Remove the JVM TI hprof Agent
241: Remove the jhat Tool
243: Java-Level JVM Compiler Interface
244: TLS Application-Layer Protocol Negotiation
Extension
245: Validate JVM Command-Line Flag Arguments
246: Leverage CPU Instructions for GHASH and RSA
247: Compile for Older Platform Versions
248: Make G1 the Default Garbage Collector
How new features become part of Java
standard?
JEP process
Source: http://cr.openjdk.java.net/~mr/jep/jep-2.0-02.html
JSR
Source: https://groups.google.com/foru13m/#!topic/java-social/InafCPMLLaA
Modularity/Project Jigshaw: A revolutionary
enhancement
Jigsaw
JEP 220: Modular Run-Time Images
JEP 201: Modular Source Code
JEP 260: Encapsulate Most Internal
APIs
JEP 282: jlink: The Java Linker
JEP 162: Prepare for Modularization
JSR 376: Java Platform Module System JEP 200: The Modular JDK
JEP 261: Module System
Modularity
Java Module
Why Modularity: Problem with Java 8
• Java Runtime getting bigger and bigger.
– Java 8 compact profile 1, 2 and 3 is the partial solution of Modularity.
• Jar and classpath hell.
– Hard to determine if anything missing.
– Hard to find internal conflict.
– Lazy class loading and initialization – NoClassDefFoundError.
• For code that escapes packages the visibility mechanism is poor - only
public.
– Classes from different packages “see” each other, even from different class loaders
– SecurityManager helps to protect, but it is not on by default
Why Modularity: Problem with Java 8
Why Modularity?
Why Modularity?
Why Modularity: Problem with Java 8
java.io
java.lang
java.lang.annotation
java.lang.invoke
java.lang.ref
java.lang.reflect
java.math
java.net
java.nio
java.nio.channels
java.nio.channels.spi
java.nio.charset
java.nio.charset.spi
java.nio.file
java.nio.file.attribute
java.nio.file.spi
java.security
java.security.cert
java.security.interfaces
java.security.spec
java.text
java.text.spi
java.time
java.time.chrono
java.time.format
java.time.temporal
java.time.zone
java.util
java.util.concurrent
java.util.concurrent.atomic
java.util.concurrent.locks
java.util.function
java.util.jar
java.util.regex
java.util.spi
java.util.stream
java.util.zip
javax.crypto
javax.crypto.interfaces
javax.crypto.spec
javax.security.auth
javax.security.auth.callback
javax.security.auth.login
javax.security.auth.spi
javax.security.auth.x500
jdk
jdk.internal.org.objectweb.asm
jdk.internal.org.xml.sax
jdk.internal.util.xml
jdk.internal.util.xml.impl
jdk.jigsaw.module
jdk.jigsaw.tools.jlink
jdk.joptsimple
jdk.joptsimple.internal
jdk.joptsimple.util
sun.invoke
sun.invoke.anon
sun.invoke.empty
sun.invoke.util
sun.launcher
sun.launcher.resources
sun.misc
sun.misc.resources
sun.net
sun.net.ftp
sun.net.ftp.impl
sun.net.idn
sun.net.sdp
sun.net.smtp
sun.net.spi
sun.net.spi.nameservice
sun.net.util
sun.net.www
sun.net.www.content.text
sun.net.www.http
sun.net.www.protocol.file
sun.net.www.protocol.ftp
sun.net.www.protocol.http
sun.net.www.protocol.jar
sun.net.www.protocol.mailto
sun.net.www.protocol.netdoc
sun.nio
sun.nio.ch
sun.nio.cs
sun.nio.fs
sun.reflect
sun.reflect.annotation
sun.reflect.generics.factory
sun.reflect.generics.parser
sun.reflect.generics.scope
sun.reflect.generics.tree
sun.reflect.generics.visitor
sun.reflect.misc
sun.security.action
sun.security.jca
sun.security.pkcs
sun.security.pkcs12
sun.security.provider
sun.security.provider.certpath
sun.security.rsa
sun.security.timestamp
sun.security.util
sun.security.validator
sun.security.x509
sun.text
sun.text.bidi
sun.text.normalizer
sun.text.resources
sun.text.resources.cldr
sun.text.resources.cldr.en
sun.text.resources.en
sun.util
sun.util.calendar
sun.util.cldr
sun.util.locale
sun.util.locale.provider
sun.util.logging
sun.util.logging.resources
sun.util.resources
sun.util.resources.cldr
sun.util.resources.cldr.en
sun.util.resources.en
sun.util.spi
Java 8 Compact Profile
JRE : 54 MB
Compact 3:
30 MB
Compact 2:
16 MB
Compact 1:
11 MB
4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. #DV13 #Jigsaw @mreinhold
tls
logging
auth
jdbc
jta
jaxpnaming
rowset
kerberos
management
compiler
xmldsig
crypto
cosnaming
management.iiop
corba
desktop
tools.jre
jaxws
httpserverjavafx
prefssctp jx.annotations
instrument base
54MB 30 16 11 nashornscript
rmi
-classpath
Java 8: Jar/Classpath Hell
antlr-2.7.7.jar aopalliance-1.0.jar aopalliance-repackaged-2.4.0-b10.jar asm-all-repackaged-2.4.0-b10.jar aspectjrt-1.8.5.jar
aspectjweaver-1.8.5.jar bean-validator-2.4.0-b10.jar classmate-1.0.0.jar class-model-2.4.0-b10.jar commons-beanutils-1.9.2.jar
commons-codec-1.10.jar commons-collections-3.2.1.jar commons-compiler-2.7.8.jar commons-dbcp-1.4.jar commons-fileupload-
1.3.1.jar commons-io-2.4.jar commons-lang3-3.2.1.jar commons-logging-1.1.1.jar commons-pool-1.5.4.jar config-types-2.4.0-
b10.jar core-2.4.0-b10.jar db2jcc-4.0.jar disruptor-3.2.1.jar dom4j-1.6.1.jar gs-collections-5.1.0.jar gs-collections-api-5.1.0.jar
gson-2.3.1.jar guava-18.0.jar hibernate-commons-annotations-4.0.5.Final.jar hibernate-core-4.3.10.Final.jar hibernate-
entitymanager-4.3.10.Final.jar hibernate-jpa-2.1-api-1.0.0.Final.jar hibernate-validator-5.1.3.Final.jar hk2-2.4.0-b10.jar hk2-api-
2.4.0-b10.jar hk2-config-2.4.0-b10.jar hk2-locator-2.4.0-b10.jar hk2-runlevel-2.4.0-b10.jar hk2-utils-2.4.0-b10.jar httpasyncclient-
4.0.2.jar httpclient-4.3.6.jar httpcore-4.3.3.jar httpcore-nio-4.3.2.jar httpmime-4.3.6.jar jackson-annotations-2.4.5.jar jackson-
core-2.4.5.jar jackson-databind-2.4.5.jar jackson-dataformat-yaml-2.4.5.jar jackson-datatype-joda-2.4.5.jar jandex-1.1.0.Final.jar
janino-2.7.8.jar javaee-web-api-7.0.jar javassist-3.18.1-GA.jar javax.annotation-api-1.2.jar javax.inject-1.jar javax.inject-2.4.0-
b10.jar javax.ws.rs-api-2.0.1.jar jboss-logging-3.1.3.GA.jar jboss-logging-annotations-1.2.0.Beta1.jar jboss-transaction-
api_1.2_spec-1.0.0.Final.jar jcl-over-slf4j-1.7.10.jar jersey-client-2.17.jar jersey-common-2.17.jar jersey-container-servlet-core-
2.17.jar jersey-guava-2.17.jar jersey-media-jaxb-2.17.jar jersey-server-2.17.jar jersey-spring3-2.17.jar jldap-4.3.jar joda-time-
2.2.jar json-20140107.jar jsr166e-1.0.jar logback-classic-1.1.3.jar logback-core-1.1.3.jar osgi-resource-locator-1.0.1.jar postgresql-
9.4-1201-jdbc41.jar reactor-core-1.1.4.RELEASE.jar slf4j-api-1.7.10.jar snakeyaml-1.12.jar spring-aop-4.1.6.RELEASE.jar spring-
beans-4.1.6.RELEASE.jar spring-bridge-2.4.0-b10.jar spring-context-4.1.6.RELEASE.jar spring-core-4.1.6.RELEASE.jar spring-data-
commons-1.10.0.RELEASE.jar spring-data-jpa-1.8.0.RELEASE.jar spring-expression-4.1.6.RELEASE.jar spring-integration-core-
4.1.2.RELEASE.jar spring-integration-jdbc-4.1.2.RELEASE.jar spring-jdbc-4.1.6.RELEASE.jar spring-messaging-4.1.4.RELEASE.jar
spring-orm-4.1.6.RELEASE.jar spring-retry-1.1.1.RELEASE.jar spring-security-config-4.0.2.RELEASE.jar spring-security-core-
4.0.2.RELEASE.jar spring-security-web-4.0.2.RELEASE.jar spring-tx-4.1.6.RELEASE.jar spring-web-4.1.6.RELEASE.jar spring-webmvc-
4.1.6.RELEASE.jar swagger-annotations-1.5.3.jar swagger-core-1.5.3.jar swagger-models-1.5.3.jar tiger-types-1.4.jar unirest-java-
1.4.7.jar validation-api-1.1.0.Final.jar webservices-api-2.3.1.jar webservices-rt-2.3.1.jar wicket-auth-roles-7.0.0.jar wicket-core-
7.0.0.jar wicket-request-7.0.0.jar wicket-util-7.0.0.jar xml-apis-1.0.b2.jar
Java 8: Jar/Classpath Hell
• Is there anything Missing?
• Is there any internal conflict?
• Is there any of these jar uses internal classes?
Java 8: Jar/Classpath Hell
antlr-2.7.7.jar aopalliance-1.0.jar aopalliance-repackaged-2.4.0-b10.jar asm-all-repackaged-2.4.0-b10.jar aspectjrt-1.8.5.jar
aspectjweaver-1.8.5.jar bean-validator-2.4.0-b10.jar classmate-1.0.0.jar class-model-2.4.0-b10.jar commons-beanutils-1.9.2.jar
commons-codec-1.10.jar commons-collections-3.2.1.jar commons-compiler-2.7.8.jar commons-dbcp-1.4.jar commons-fileupload-
1.3.1.jar commons-io-2.4.jar commons-lang3-3.2.1.jar commons-logging-1.1.1.jar commons-pool-1.5.4.jar config-types-2.4.0-
b10.jar core-2.4.0-b10.jar db2jcc-4.0.jar disruptor-3.2.1.jar dom4j-1.6.1.jar gs-collections-5.1.0.jar gs-collections-api-5.1.0.jar
gson-2.3.1.jar guava-18.0.jar hibernate-commons-annotations-4.0.5.Final.jar hibernate-core-4.3.10.Final.jar hibernate-
entitymanager-4.3.10.Final.jar hibernate-jpa-2.1-api-1.0.0.Final.jar hibernate-validator-5.1.3.Final.jar hk2-2.4.0-b10.jar hk2-api-
2.4.0-b10.jar hk2-config-2.4.0-b10.jar hk2-locator-2.4.0-b10.jar hk2-runlevel-2.4.0-b10.jar hk2-utils-2.4.0-b10.jar httpasyncclient-
4.0.2.jar httpclient-4.3.6.jar httpcore-4.3.3.jar httpcore-nio-4.3.2.jar httpmime-4.3.6.jar jackson-annotations-2.4.5.jar jackson-
core-2.4.5.jar jackson-databind-2.4.5.jar jackson-dataformat-yaml-2.4.5.jar jackson-datatype-joda-2.4.5.jar jandex-1.1.0.Final.jar
janino-2.7.8.jar javaee-web-api-7.0.jar javassist-3.18.1-GA.jar javax.annotation-api-1.2.jar javax.inject-1.jar javax.inject-2.4.0-
b10.jar javax.ws.rs-api-2.0.1.jar jboss-logging-3.1.3.GA.jar jboss-logging-annotations-1.2.0.Beta1.jar jboss-transaction-
api_1.2_spec-1.0.0.Final.jar jcl-over-slf4j-1.7.10.jar jersey-client-2.17.jar jersey-common-2.17.jar jersey-container-servlet-core-
2.17.jar jersey-guava-2.17.jar jersey-media-jaxb-2.17.jar jersey-server-2.17.jar jersey-spring3-2.17.jar jldap-4.3.jar joda-time-
2.2.jar json-20140107.jar jsr166e-1.0.jar logback-classic-1.1.3.jar logback-core-1.1.3.jar osgi-resource-locator-1.0.1.jar postgresql-
9.4-1201-jdbc41.jar reactor-core-1.1.4.RELEASE.jar slf4j-api-1.7.10.jar snakeyaml-1.12.jar spring-aop-4.1.6.RELEASE.jar spring-
beans-4.1.6.RELEASE.jar spring-bridge-2.4.0-b10.jar spring-context-4.1.6.RELEASE.jar spring-core-4.1.6.RELEASE.jar spring-data-
commons-1.10.0.RELEASE.jar spring-data-jpa-1.8.0.RELEASE.jar spring-expression-4.1.6.RELEASE.jar spring-integration-core-
4.1.2.RELEASE.jar spring-integration-jdbc-4.1.2.RELEASE.jar spring-jdbc-4.1.6.RELEASE.jar spring-messaging-4.1.4.RELEASE.jar
spring-orm-4.1.6.RELEASE.jar spring-retry-1.1.1.RELEASE.jar spring-security-config-4.0.2.RELEASE.jar spring-security-core-
4.0.2.RELEASE.jar spring-security-web-4.0.2.RELEASE.jar spring-tx-4.1.6.RELEASE.jar spring-web-4.1.6.RELEASE.jar spring-webmvc-
4.1.6.RELEASE.jar swagger-annotations-1.5.3.jar swagger-core-1.5.3.jar swagger-models-1.5.3.jar tiger-types-1.4.jar unirest-java-
1.4.7.jar validation-api-1.1.0.Final.jar webservices-api-2.3.1.jar webservices-rt-2.3.1.jar wicket-auth-roles-7.0.0.jar wicket-core-
7.0.0.jar wicket-request-7.0.0.jar wicket-util-7.0.0.jar xml-apis-1.0.b2.jar
Java 8: Jar/Classpath Hell
antlr-2.7.7.jar aopalliance-1.0.jar aopalliance-repackaged-2.4.0-b10.jar asm-all-repackaged-2.4.0-b10.jar aspectjrt-1.8.5.jar
aspectjweaver-1.8.5.jar bean-validator-2.4.0-b10.jar classmate-1.0.0.jar class-model-2.4.0-b10.jar commons-beanutils-1.9.2.jar
commons-codec-1.10.jar commons-collections-3.2.1.jar commons-compiler-2.7.8.jar commons-dbcp-1.4.jar commons-fileupload-
1.3.1.jar commons-io-2.4.jar commons-lang3-3.2.1.jar commons-logging-1.1.1.jar commons-pool-1.5.4.jar config-types-2.4.0-
b10.jar core-2.4.0-b10.jar db2jcc-4.0.jar disruptor-3.2.1.jar dom4j-1.6.1.jar gs-collections-5.1.0.jar gs-collections-api-5.1.0.jar
gson-2.3.1.jar guava-18.0.jar hibernate-commons-annotations-4.0.5.Final.jar hibernate-core-4.3.10.Final.jar hibernate-
entitymanager-4.3.10.Final.jar hibernate-jpa-2.1-api-1.0.0.Final.jar hibernate-validator-5.1.3.Final.jar hk2-2.4.0-b10.jar hk2-api-
2.4.0-b10.jar hk2-config-2.4.0-b10.jar hk2-locator-2.4.0-b10.jar hk2-runlevel-2.4.0-b10.jar hk2-utils-2.4.0-b10.jar httpasyncclient-
4.0.2.jar httpclient-4.3.6.jar httpcore-4.3.3.jar httpcore-nio-4.3.2.jar httpmime-4.3.6.jar jackson-annotations-2.4.5.jar jackson-
core-2.4.5.jar jackson-databind-2.4.5.jar jackson-dataformat-yaml-2.4.5.jar jackson-datatype-joda-2.4.5.jar jandex-1.1.0.Final.jar
janino-2.7.8.jar javaee-web-api-7.0.jar javassist-3.18.1-GA.jar javax.annotation-api-1.2.jar javax.inject-1.jar javax.inject-2.4.0-
b10.jar javax.ws.rs-api-2.0.1.jar jboss-logging-3.1.3.GA.jar jboss-logging-annotations-1.2.0.Beta1.jar jboss-transaction-
api_1.2_spec-1.0.0.Final.jar jcl-over-slf4j-1.7.10.jar jersey-client-2.17.jar jersey-common-2.17.jar jersey-container-servlet-core-
2.17.jar jersey-guava-2.17.jar jersey-media-jaxb-2.17.jar jersey-server-2.17.jar jersey-spring3-2.17.jar jldap-4.3.jar joda-time-
2.2.jar json-20140107.jar jsr166e-1.0.jar logback-classic-1.1.3.jar logback-core-1.1.3.jar osgi-resource-locator-1.0.1.jar postgresql-
9.4-1201-jdbc41.jar reactor-core-1.1.4.RELEASE.jar slf4j-api-1.7.10.jar snakeyaml-1.12.jar spring-aop-4.1.6.RELEASE.jar spring-
beans-4.1.6.RELEASE.jar spring-bridge-2.4.0-b10.jar spring-context-4.1.6.RELEASE.jar spring-core-4.1.6.RELEASE.jar spring-data-
commons-1.10.0.RELEASE.jar spring-data-jpa-1.8.0.RELEASE.jar spring-expression-4.1.6.RELEASE.jar spring-integration-core-
4.1.2.RELEASE.jar spring-integration-jdbc-4.1.2.RELEASE.jar spring-jdbc-4.1.6.RELEASE.jar spring-messaging-4.1.4.RELEASE.jar
spring-orm-4.1.6.RELEASE.jar spring-retry-1.1.1.RELEASE.jar spring-security-config-4.0.2.RELEASE.jar spring-security-core-
4.0.2.RELEASE.jar spring-security-web-4.0.2.RELEASE.jar spring-tx-4.1.6.RELEASE.jar spring-web-4.1.6.RELEASE.jar spring-webmvc-
4.1.6.RELEASE.jar swagger-annotations-1.5.3.jar swagger-core-1.5.3.jar swagger-models-1.5.3.jar tiger-types-1.4.jar unirest-java-
1.4.7.jar validation-api-1.1.0.Final.jar webservices-api-2.3.1.jar webservices-rt-2.3.1.jar wicket-auth-roles-7.0.0.jar wicket-core-
7.0.0.jar wicket-request-7.0.0.jar wicket-util-7.0.0.jar xml-apis-1.0.b2.jar
Java 9: No Classpath & Internal API
-classpath
-internal
API
module
Before Modularity
After Modularity
Module
Module
Package
Class/Interface
Fields/Methods
Module
module = A container of packages
Module can exports specific package to all
Module can exports specific package to specific module
Module can import other module
Module
module-info.java
exports [packages]
exports [package] to [module]
requires [other module]
Modular Security
Accessibility (Java 1 to 8)
• public
• protected
• default
• private
Modular Security
Accessibility (Java 9)
• public
– public to everyone
– public, but only to specific modules
– public only within a module
• protected
• default
• private
public ≠ accessible (fundamental change to Java)
4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. #DV13 #Jigsaw @mreinhold
tls
logging
auth
jdbc
jta
jaxpnaming
rowset
kerberos
management
compiler
xmldsig
crypto
cosnaming
management.iiop
corba
desktop
tools.jre
jaxws
httpserverjavafx
prefssctp jx.annotations
instrument base
54MB 30 16 11 nashornscript
rmi
4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. #DV13 #Jigsaw @mreinhold
tls
logging
auth
jdbc
jta
jaxpnaming
rowset
kerberos
management
compiler
xmldsig
crypto
cosnaming
management.iiop
corba
desktop
tools.jre
jaxws
httpserver
tools
tools.jaxws tools.base
devtools
javafx
prefssctp jx.annotations
instrument base
54MB 30 16 11 nashornscript
rmi
4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. #DV13 #Jigsaw @mreinhold
tls
logging
auth
jdbc
jta
jaxpnaming
rowset
kerberos
management
compiler
xmldsig
crypto
cosnaming
management.iiop
corba
desktop
tools.jre
jaxws
httpserver
tools
tools.jaxws tools.base
devtools
javafx
prefssctp jx.annotations
instrument base
nashornscript
rmi
tls
logging
auth
jdbc
jta
jaxpnaming
rowset
kerberos
management
compiler
xmldsig
crypto
cosnaming
management.iiop
corba
desktop
tools.jre
jaxws
httpserver
tools
tools.jaxws tools.base
devtools
javafx
prefssctp jx.annotations
instrument base
nashornscript
rmi
Modularity Demo
Modularity Demo
module app {
}
nl/cimsolutions/Main.java
module-info.java
Modularity Demo
module app {
requires alpha;
}
app
alpha
Modularity Demo
module app {
requires alpha;
requires java.desktop;
}
app
alpha desktop
Modularity Demo
module alpha {
exports org.forpublic;
}
alpha
org.forpublic
org.forinternal
Modularity Benefits
•Scalability
•Performance
•Security
JDK Structure
bin
Pre-JDK 9 JDK 9
lib
tools.jar
jre
bin
rt.jar
lib
libconfbin
jre directory
tools.jar
rt.jar
JEP 222: jshell-The Java Shell (Read-Eval-Print
Loop)
What is jshell?
• Tool providing a dynamic interaction with the Java™ programming
language
• Read-Evaluate-Print Loop (REPL) for the Java™ platform
– Type in a snippet of Java code, see the results
• Deeply integrated with JDK tool-set
– Stays current and compatible
• Also, an API for use within other applications
What jshell is “Not”?
• Not a new language
– “Snippets” of pure
• No new syntax
• Not a replacement for the compiler
• Not an IDE (Integrated Development Environment)
Who wants jshell?
• New to Java, new to programming
– Start with expressions vs classes
– Immediate feedback
• Exploring a new API or language feature
– Experiment and instantly see results
• Prototyping
– Incrementally write complex code
Without jshell: Edit Compile Run
• Write a full program:
– Class
– Imports
– main method
• Cycle the whole program to understand if the behavior is
correct:
– Edit
– Compiler or IDE
– Execute
Without jshell: Edit Compile Run
> edit Hello.java
public class Hello {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
> javac Hello.java
> java Hello
………….. Repeat
With jshell
>jshell
| Welcome to JShell -- Version 9-ea
| For an introduction type: /help intro
jshell> System.out.println("Hello World")
Hello World
Jshell Demo
JEP 269: Convenience Factory Methods for
Collections
New Collection API
• Java Collection is verbose.
• Ruby Collection:
list = [1, 2, 3]
set = Set.new [1, 2, 3]
map = { ‘a’=> 1, ‘b’ => 2, ‘c’ => 3}
• Java Collection:
List<Integer> list = Arrays.asList(1, 2, 3);
Set<Integer> set = new HashSet<>(Arrays.asList(1, 2, 3));
Map<String, Integer> map = new HashMap<>();
map.put(“a”,1);
map.put(“b”,2);
map.put(“c”,3);
New Collection API
• Java Collection is verbose.
• Python Collection:
list = [1, 2, 3]
set = {1, 2, 3}
map = { ‘a’ : 1, ‘b’ : 2, ‘c’ : 3}
• Java Collection:
List<Integer> list = Arrays.asList(1, 2, 3);
Set<Integer> set = new HashSet<>(Arrays.asList(1, 2, 3));
Map<String, Integer> map = new HashMap<>();
map.put(“a”,1);
map.put(“b”,2);
map.put(“c”,3);
New Collection API
List<Integer> list = Arrays.asList(1, 2, 3);
Set<Integer> set = new HashSet<>(Arrays.asList(1, 2, 3));
Map<String, Integer> map = new HashMap<>();
map.put(“a”,1);
map.put(“b”,2);
map.put(“c”,3);
List<Integer> list = List.of(1, 2, 3);
Set<Integer> set = Set.of(1, 2, 3);
Map<String, Integer> map = Map.ofEntries(entry(“a”,1), entry(“b”,2), entry(“c”,3));
G1 : New Garbage collector
• Now GC is the default garbage collector.
• In JDK 9, the G1 the default garbage collector.
• Many performance improvements were made to G1 in JDK 8 and its update
releases, and further improvements are planned for JDK 9.
• The introduction of concurrent class unloading (JEP 156) in JDK 8u40 made G1 a
fully-featured garbage collector, ready to be the default.
HTML 5 and Javadoc Search
• Enhance the javadoc tool to generate HTML5 markup.
• Add a search box to generated API documentation that can be used to search for program elements and
tagged words and phrases within the documentation.
Deprecate the Applet API
Add the @Deprecated(since="9") annotation to the following classes:
• java.applet.AppletStub
• java.applet.Applet
• java.applet.AudioClip
• java.applet.AppletContext
• javax.swing.JApplet
Process API Update
• JEP 102: Process API Updates
• New:
– Get PID number from JVM
– Get list of processes
– Operations on tree of processes
Process API Update
Process proc = Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c",
"echo $PPID"});
if (proc.waitFor() == 0) {
InputStream in = proc.getInputStream();
int available = in.available();
byte[] outputBytes = new byte[available];
in.read(outputBytes);
String pid = new String(outputBytes);
System.out.println("Your pid is " + pid);
}
System.out.println("Your pid is " + ProcessHandle.current().getPid());
Summary
• Modularisation is a big change for Java
– JVM/JRE rather than language/APIs
– Public access isn’t necessarily the same
• Flexibility to define what is exported
• New linking capability to generate runtime image
• More to learn about converting existing code
• Will make all applications simpler to deploy and manage
Q & A

More Related Content

What's hot

Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVMRyan Cuprak
 
How to cook lettuce @Java casual
How to cook lettuce @Java casualHow to cook lettuce @Java casual
How to cook lettuce @Java casualGo Hagiwara
 
JDK 9: Big Changes To Make Java Smaller
JDK 9: Big Changes To Make Java SmallerJDK 9: Big Changes To Make Java Smaller
JDK 9: Big Changes To Make Java SmallerSimon 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
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondSimon Ritter
 
Migration Spring Boot PetClinic REST to Quarkus 1.2.0
Migration Spring Boot PetClinic REST to Quarkus 1.2.0Migration Spring Boot PetClinic REST to Quarkus 1.2.0
Migration Spring Boot PetClinic REST to Quarkus 1.2.0Jonathan Vila
 
Apache Tomcat 7 by Filip Hanik
Apache Tomcat 7 by Filip HanikApache Tomcat 7 by Filip Hanik
Apache Tomcat 7 by Filip HanikEdgar Espina
 
Beginners guide-to-reverse-engineering-android-apps-pau-oliva-fora-viaforensi...
Beginners guide-to-reverse-engineering-android-apps-pau-oliva-fora-viaforensi...Beginners guide-to-reverse-engineering-android-apps-pau-oliva-fora-viaforensi...
Beginners guide-to-reverse-engineering-android-apps-pau-oliva-fora-viaforensi...viaForensics
 
55 New Features in JDK 9
55 New Features in JDK 955 New Features in JDK 9
55 New Features in JDK 9Simon Ritter
 
Simple tweaks to get the most out of your jvm
Simple tweaks to get the most out of your jvmSimple tweaks to get the most out of your jvm
Simple tweaks to get the most out of your jvmJamie Coleman
 
Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Ryan Cuprak
 
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
 
How To Access Code In Large w/ Vim
How To Access Code In Large w/ VimHow To Access Code In Large w/ Vim
How To Access Code In Large w/ VimCheng Hsien Chen
 
JavaPerformanceChapter_3
JavaPerformanceChapter_3JavaPerformanceChapter_3
JavaPerformanceChapter_3Saurav Basu
 

What's hot (20)

Polygot Java EE on the GraalVM
Polygot Java EE on the GraalVMPolygot Java EE on the GraalVM
Polygot Java EE on the GraalVM
 
How to cook lettuce @Java casual
How to cook lettuce @Java casualHow to cook lettuce @Java casual
How to cook lettuce @Java casual
 
JDK-9: Modules and Java Linker
JDK-9: Modules and Java LinkerJDK-9: Modules and Java Linker
JDK-9: Modules and Java Linker
 
JDK 9: Big Changes To Make Java Smaller
JDK 9: Big Changes To Make Java SmallerJDK 9: Big Changes To Make Java Smaller
JDK 9: Big Changes To Make Java Smaller
 
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, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 
Migration Spring Boot PetClinic REST to Quarkus 1.2.0
Migration Spring Boot PetClinic REST to Quarkus 1.2.0Migration Spring Boot PetClinic REST to Quarkus 1.2.0
Migration Spring Boot PetClinic REST to Quarkus 1.2.0
 
Apache Tomcat 7 by Filip Hanik
Apache Tomcat 7 by Filip HanikApache Tomcat 7 by Filip Hanik
Apache Tomcat 7 by Filip Hanik
 
What's New in Java 9
What's New in Java 9What's New in Java 9
What's New in Java 9
 
Beginners guide-to-reverse-engineering-android-apps-pau-oliva-fora-viaforensi...
Beginners guide-to-reverse-engineering-android-apps-pau-oliva-fora-viaforensi...Beginners guide-to-reverse-engineering-android-apps-pau-oliva-fora-viaforensi...
Beginners guide-to-reverse-engineering-android-apps-pau-oliva-fora-viaforensi...
 
55 New Features in JDK 9
55 New Features in JDK 955 New Features in JDK 9
55 New Features in JDK 9
 
Simple tweaks to get the most out of your jvm
Simple tweaks to get the most out of your jvmSimple tweaks to get the most out of your jvm
Simple tweaks to get the most out of your jvm
 
Evolution of java
Evolution of javaEvolution of java
Evolution of java
 
JDK 9 Deep Dive
JDK 9 Deep DiveJDK 9 Deep Dive
JDK 9 Deep Dive
 
GlassFish v2.1
GlassFish v2.1GlassFish v2.1
GlassFish v2.1
 
Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)Why jakarta ee matters (ConFoo 2021)
Why jakarta ee matters (ConFoo 2021)
 
Docker In the Bank
Docker In the BankDocker In the Bank
Docker In the Bank
 
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?
 
How To Access Code In Large w/ Vim
How To Access Code In Large w/ VimHow To Access Code In Large w/ Vim
How To Access Code In Large w/ Vim
 
JavaPerformanceChapter_3
JavaPerformanceChapter_3JavaPerformanceChapter_3
JavaPerformanceChapter_3
 

Similar to Java 9 new features

Java 40 versions_sgp
Java 40 versions_sgpJava 40 versions_sgp
Java 40 versions_sgpmichaelisvy
 
Java 7 and 8, what does it mean for you
Java 7 and 8, what does it mean for youJava 7 and 8, what does it mean for you
Java 7 and 8, what does it mean for youDmitry Buzdin
 
New Features of Java7 SE
New Features of Java7 SENew Features of Java7 SE
New Features of Java7 SEdogangoko
 
Java and OpenJDK: disecting the ecosystem
Java and OpenJDK: disecting the ecosystemJava and OpenJDK: disecting the ecosystem
Java and OpenJDK: disecting the ecosystemRafael Winterhalter
 
Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009Arun Gupta
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache KafkaShiao-An Yuan
 
JDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKJDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKWolfgang Weigend
 
Jruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaKeith Bennett
 
Comparing Java performance: Red Hat Enterprise Linux 6 and OpenJDK vs. Micros...
Comparing Java performance: Red Hat Enterprise Linux 6 and OpenJDK vs. Micros...Comparing Java performance: Red Hat Enterprise Linux 6 and OpenJDK vs. Micros...
Comparing Java performance: Red Hat Enterprise Linux 6 and OpenJDK vs. Micros...Principled Technologies
 
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"GlobalLogic Ukraine
 
Jaoo Michael Neale 09
Jaoo Michael Neale 09Jaoo Michael Neale 09
Jaoo Michael Neale 09Michael Neale
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEQAware GmbH
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEMario-Leander Reimer
 
JRuby on Rails Deployment: What They Didn't Tell You
JRuby on Rails Deployment: What They Didn't Tell YouJRuby on Rails Deployment: What They Didn't Tell You
JRuby on Rails Deployment: What They Didn't Tell Youelliando dias
 

Similar to Java 9 new features (20)

Java 40 versions_sgp
Java 40 versions_sgpJava 40 versions_sgp
Java 40 versions_sgp
 
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
 
Java 7 and 8, what does it mean for you
Java 7 and 8, what does it mean for youJava 7 and 8, what does it mean for you
Java 7 and 8, what does it mean for you
 
De Java 8 ate Java 14
De Java 8 ate Java 14De Java 8 ate Java 14
De Java 8 ate Java 14
 
New Features of Java7 SE
New Features of Java7 SENew Features of Java7 SE
New Features of Java7 SE
 
Java and OpenJDK: disecting the ecosystem
Java and OpenJDK: disecting the ecosystemJava and OpenJDK: disecting the ecosystem
Java and OpenJDK: disecting the ecosystem
 
Java On Speed
Java On SpeedJava On Speed
Java On Speed
 
Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009Dynamic Languages Web Frameworks Indicthreads 2009
Dynamic Languages Web Frameworks Indicthreads 2009
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
What's new in Java 11
What's new in Java 11What's new in Java 11
What's new in Java 11
 
JDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKJDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDK
 
Jruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-java
 
Comparing Java performance: Red Hat Enterprise Linux 6 and OpenJDK vs. Micros...
Comparing Java performance: Red Hat Enterprise Linux 6 and OpenJDK vs. Micros...Comparing Java performance: Red Hat Enterprise Linux 6 and OpenJDK vs. Micros...
Comparing Java performance: Red Hat Enterprise Linux 6 and OpenJDK vs. Micros...
 
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
Java Webinar #12: "Java Versions and Features: Since JDK 8 to 16"
 
Jaoo Michael Neale 09
Jaoo Michael Neale 09Jaoo Michael Neale 09
Jaoo Michael Neale 09
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EE
 
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EEA Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EE
 
GlassFish and JavaEE, Today and Future
GlassFish and JavaEE, Today and FutureGlassFish and JavaEE, Today and Future
GlassFish and JavaEE, Today and Future
 
JRuby on Rails Deployment: What They Didn't Tell You
JRuby on Rails Deployment: What They Didn't Tell YouJRuby on Rails Deployment: What They Didn't Tell You
JRuby on Rails Deployment: What They Didn't Tell You
 

More from Masudul Haque

More from Masudul Haque (6)

Websocket
WebsocketWebsocket
Websocket
 
Java 8 lambda
Java 8 lambdaJava 8 lambda
Java 8 lambda
 
Java-7: Collections
Java-7: CollectionsJava-7: Collections
Java-7: Collections
 
Java: Regular Expression
Java: Regular ExpressionJava: Regular Expression
Java: Regular Expression
 
Java-7 Concurrency
Java-7 ConcurrencyJava-7 Concurrency
Java-7 Concurrency
 
Basic java
Basic javaBasic java
Basic java
 

Recently uploaded

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Java 9 new features

  • 1. Java 9 : New Features 07 juli 2016 Masudul Haque
  • 2. Agenda • Introduction • Java 9 Milestones • JEP & JSR • Modularity/Project Jigshaw: A revolutionary enhancement • Java shell/ REPL : Real Eval Print Loop • New Collection API • Small Changes • Summary • Q/A
  • 4.
  • 5. Java in Numbers • #1 Development Platform in the world • 9 Millions Developers • 800.000 Java Certifications • 7 Billion devices run Java • 1 Billion Java Downloads per Year • 97% of Enterprise Desktops run Java • 100% of Blu-ray Disc Players ship with Java
  • 6. Java is in race
  • 7. Java is in race: TIOBE index
  • 11. Java 9: what is it 102: Process API Updates 110: HTTP 2 Client 143: Improve Contended Locking 158: Unified JVM Logging 165: Compiler Control 193: Variable Handles 197: Segmented Code Cache 199: Smart Java Compilation, Phase Two 200: The Modular JDK 201: Modular Source Code 211: Elide Deprecation Warnings on Import Statements 212: Resolve Lint and Doclint Warnings 213: Milling Project Coin 214: Remove GC Combinations Deprecated in JDK 8 215: Tiered Attribution for javac 216: Process Import Statements Correctly 217: Annotations Pipeline 2.0 219: Datagram Transport Layer Security (DTLS) 220: Modular Run-Time Images 221: Simplified Doclet API 222: jshell: The Java Shell (Read-Eval-Print Loop) 226: UTF-8 Property Files 227: Unicode 7.0 228: Add More Diagnostic Commands 231: Remove Launch-Time JRE Version Selection 232: Improve Secure Application Performance 233: Generate Run-Time Compiler Tests Automatically 235: Test Class-File Attributes Generated by javac 236: Parser API for Nashorn 237: Linux/AArch64 Port 240: Remove the JVM TI hprof Agent 241: Remove the jhat Tool 243: Java-Level JVM Compiler Interface 244: TLS Application-Layer Protocol Negotiation Extension 245: Validate JVM Command-Line Flag Arguments 246: Leverage CPU Instructions for GHASH and RSA 247: Compile for Older Platform Versions 248: Make G1 the Default Garbage Collector
  • 12. How new features become part of Java standard?
  • 15. Modularity/Project Jigshaw: A revolutionary enhancement
  • 16. Jigsaw JEP 220: Modular Run-Time Images JEP 201: Modular Source Code JEP 260: Encapsulate Most Internal APIs JEP 282: jlink: The Java Linker JEP 162: Prepare for Modularization JSR 376: Java Platform Module System JEP 200: The Modular JDK JEP 261: Module System Modularity Java Module
  • 17. Why Modularity: Problem with Java 8 • Java Runtime getting bigger and bigger. – Java 8 compact profile 1, 2 and 3 is the partial solution of Modularity. • Jar and classpath hell. – Hard to determine if anything missing. – Hard to find internal conflict. – Lazy class loading and initialization – NoClassDefFoundError. • For code that escapes packages the visibility mechanism is poor - only public. – Classes from different packages “see” each other, even from different class loaders – SecurityManager helps to protect, but it is not on by default
  • 18. Why Modularity: Problem with Java 8
  • 21. Why Modularity: Problem with Java 8 java.io java.lang java.lang.annotation java.lang.invoke java.lang.ref java.lang.reflect java.math java.net java.nio java.nio.channels java.nio.channels.spi java.nio.charset java.nio.charset.spi java.nio.file java.nio.file.attribute java.nio.file.spi java.security java.security.cert java.security.interfaces java.security.spec java.text java.text.spi java.time java.time.chrono java.time.format java.time.temporal java.time.zone java.util java.util.concurrent java.util.concurrent.atomic java.util.concurrent.locks java.util.function java.util.jar java.util.regex java.util.spi java.util.stream java.util.zip javax.crypto javax.crypto.interfaces javax.crypto.spec javax.security.auth javax.security.auth.callback javax.security.auth.login javax.security.auth.spi javax.security.auth.x500 jdk jdk.internal.org.objectweb.asm jdk.internal.org.xml.sax jdk.internal.util.xml jdk.internal.util.xml.impl jdk.jigsaw.module jdk.jigsaw.tools.jlink jdk.joptsimple jdk.joptsimple.internal jdk.joptsimple.util sun.invoke sun.invoke.anon sun.invoke.empty sun.invoke.util sun.launcher sun.launcher.resources sun.misc sun.misc.resources sun.net sun.net.ftp sun.net.ftp.impl sun.net.idn sun.net.sdp sun.net.smtp sun.net.spi sun.net.spi.nameservice sun.net.util sun.net.www sun.net.www.content.text sun.net.www.http sun.net.www.protocol.file sun.net.www.protocol.ftp sun.net.www.protocol.http sun.net.www.protocol.jar sun.net.www.protocol.mailto sun.net.www.protocol.netdoc sun.nio sun.nio.ch sun.nio.cs sun.nio.fs sun.reflect sun.reflect.annotation sun.reflect.generics.factory sun.reflect.generics.parser sun.reflect.generics.scope sun.reflect.generics.tree sun.reflect.generics.visitor sun.reflect.misc sun.security.action sun.security.jca sun.security.pkcs sun.security.pkcs12 sun.security.provider sun.security.provider.certpath sun.security.rsa sun.security.timestamp sun.security.util sun.security.validator sun.security.x509 sun.text sun.text.bidi sun.text.normalizer sun.text.resources sun.text.resources.cldr sun.text.resources.cldr.en sun.text.resources.en sun.util sun.util.calendar sun.util.cldr sun.util.locale sun.util.locale.provider sun.util.logging sun.util.logging.resources sun.util.resources sun.util.resources.cldr sun.util.resources.cldr.en sun.util.resources.en sun.util.spi
  • 22. Java 8 Compact Profile JRE : 54 MB Compact 3: 30 MB Compact 2: 16 MB Compact 1: 11 MB
  • 23. 4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. #DV13 #Jigsaw @mreinhold tls logging auth jdbc jta jaxpnaming rowset kerberos management compiler xmldsig crypto cosnaming management.iiop corba desktop tools.jre jaxws httpserverjavafx prefssctp jx.annotations instrument base 54MB 30 16 11 nashornscript rmi
  • 25. Java 8: Jar/Classpath Hell antlr-2.7.7.jar aopalliance-1.0.jar aopalliance-repackaged-2.4.0-b10.jar asm-all-repackaged-2.4.0-b10.jar aspectjrt-1.8.5.jar aspectjweaver-1.8.5.jar bean-validator-2.4.0-b10.jar classmate-1.0.0.jar class-model-2.4.0-b10.jar commons-beanutils-1.9.2.jar commons-codec-1.10.jar commons-collections-3.2.1.jar commons-compiler-2.7.8.jar commons-dbcp-1.4.jar commons-fileupload- 1.3.1.jar commons-io-2.4.jar commons-lang3-3.2.1.jar commons-logging-1.1.1.jar commons-pool-1.5.4.jar config-types-2.4.0- b10.jar core-2.4.0-b10.jar db2jcc-4.0.jar disruptor-3.2.1.jar dom4j-1.6.1.jar gs-collections-5.1.0.jar gs-collections-api-5.1.0.jar gson-2.3.1.jar guava-18.0.jar hibernate-commons-annotations-4.0.5.Final.jar hibernate-core-4.3.10.Final.jar hibernate- entitymanager-4.3.10.Final.jar hibernate-jpa-2.1-api-1.0.0.Final.jar hibernate-validator-5.1.3.Final.jar hk2-2.4.0-b10.jar hk2-api- 2.4.0-b10.jar hk2-config-2.4.0-b10.jar hk2-locator-2.4.0-b10.jar hk2-runlevel-2.4.0-b10.jar hk2-utils-2.4.0-b10.jar httpasyncclient- 4.0.2.jar httpclient-4.3.6.jar httpcore-4.3.3.jar httpcore-nio-4.3.2.jar httpmime-4.3.6.jar jackson-annotations-2.4.5.jar jackson- core-2.4.5.jar jackson-databind-2.4.5.jar jackson-dataformat-yaml-2.4.5.jar jackson-datatype-joda-2.4.5.jar jandex-1.1.0.Final.jar janino-2.7.8.jar javaee-web-api-7.0.jar javassist-3.18.1-GA.jar javax.annotation-api-1.2.jar javax.inject-1.jar javax.inject-2.4.0- b10.jar javax.ws.rs-api-2.0.1.jar jboss-logging-3.1.3.GA.jar jboss-logging-annotations-1.2.0.Beta1.jar jboss-transaction- api_1.2_spec-1.0.0.Final.jar jcl-over-slf4j-1.7.10.jar jersey-client-2.17.jar jersey-common-2.17.jar jersey-container-servlet-core- 2.17.jar jersey-guava-2.17.jar jersey-media-jaxb-2.17.jar jersey-server-2.17.jar jersey-spring3-2.17.jar jldap-4.3.jar joda-time- 2.2.jar json-20140107.jar jsr166e-1.0.jar logback-classic-1.1.3.jar logback-core-1.1.3.jar osgi-resource-locator-1.0.1.jar postgresql- 9.4-1201-jdbc41.jar reactor-core-1.1.4.RELEASE.jar slf4j-api-1.7.10.jar snakeyaml-1.12.jar spring-aop-4.1.6.RELEASE.jar spring- beans-4.1.6.RELEASE.jar spring-bridge-2.4.0-b10.jar spring-context-4.1.6.RELEASE.jar spring-core-4.1.6.RELEASE.jar spring-data- commons-1.10.0.RELEASE.jar spring-data-jpa-1.8.0.RELEASE.jar spring-expression-4.1.6.RELEASE.jar spring-integration-core- 4.1.2.RELEASE.jar spring-integration-jdbc-4.1.2.RELEASE.jar spring-jdbc-4.1.6.RELEASE.jar spring-messaging-4.1.4.RELEASE.jar spring-orm-4.1.6.RELEASE.jar spring-retry-1.1.1.RELEASE.jar spring-security-config-4.0.2.RELEASE.jar spring-security-core- 4.0.2.RELEASE.jar spring-security-web-4.0.2.RELEASE.jar spring-tx-4.1.6.RELEASE.jar spring-web-4.1.6.RELEASE.jar spring-webmvc- 4.1.6.RELEASE.jar swagger-annotations-1.5.3.jar swagger-core-1.5.3.jar swagger-models-1.5.3.jar tiger-types-1.4.jar unirest-java- 1.4.7.jar validation-api-1.1.0.Final.jar webservices-api-2.3.1.jar webservices-rt-2.3.1.jar wicket-auth-roles-7.0.0.jar wicket-core- 7.0.0.jar wicket-request-7.0.0.jar wicket-util-7.0.0.jar xml-apis-1.0.b2.jar
  • 26. Java 8: Jar/Classpath Hell • Is there anything Missing? • Is there any internal conflict? • Is there any of these jar uses internal classes?
  • 27. Java 8: Jar/Classpath Hell antlr-2.7.7.jar aopalliance-1.0.jar aopalliance-repackaged-2.4.0-b10.jar asm-all-repackaged-2.4.0-b10.jar aspectjrt-1.8.5.jar aspectjweaver-1.8.5.jar bean-validator-2.4.0-b10.jar classmate-1.0.0.jar class-model-2.4.0-b10.jar commons-beanutils-1.9.2.jar commons-codec-1.10.jar commons-collections-3.2.1.jar commons-compiler-2.7.8.jar commons-dbcp-1.4.jar commons-fileupload- 1.3.1.jar commons-io-2.4.jar commons-lang3-3.2.1.jar commons-logging-1.1.1.jar commons-pool-1.5.4.jar config-types-2.4.0- b10.jar core-2.4.0-b10.jar db2jcc-4.0.jar disruptor-3.2.1.jar dom4j-1.6.1.jar gs-collections-5.1.0.jar gs-collections-api-5.1.0.jar gson-2.3.1.jar guava-18.0.jar hibernate-commons-annotations-4.0.5.Final.jar hibernate-core-4.3.10.Final.jar hibernate- entitymanager-4.3.10.Final.jar hibernate-jpa-2.1-api-1.0.0.Final.jar hibernate-validator-5.1.3.Final.jar hk2-2.4.0-b10.jar hk2-api- 2.4.0-b10.jar hk2-config-2.4.0-b10.jar hk2-locator-2.4.0-b10.jar hk2-runlevel-2.4.0-b10.jar hk2-utils-2.4.0-b10.jar httpasyncclient- 4.0.2.jar httpclient-4.3.6.jar httpcore-4.3.3.jar httpcore-nio-4.3.2.jar httpmime-4.3.6.jar jackson-annotations-2.4.5.jar jackson- core-2.4.5.jar jackson-databind-2.4.5.jar jackson-dataformat-yaml-2.4.5.jar jackson-datatype-joda-2.4.5.jar jandex-1.1.0.Final.jar janino-2.7.8.jar javaee-web-api-7.0.jar javassist-3.18.1-GA.jar javax.annotation-api-1.2.jar javax.inject-1.jar javax.inject-2.4.0- b10.jar javax.ws.rs-api-2.0.1.jar jboss-logging-3.1.3.GA.jar jboss-logging-annotations-1.2.0.Beta1.jar jboss-transaction- api_1.2_spec-1.0.0.Final.jar jcl-over-slf4j-1.7.10.jar jersey-client-2.17.jar jersey-common-2.17.jar jersey-container-servlet-core- 2.17.jar jersey-guava-2.17.jar jersey-media-jaxb-2.17.jar jersey-server-2.17.jar jersey-spring3-2.17.jar jldap-4.3.jar joda-time- 2.2.jar json-20140107.jar jsr166e-1.0.jar logback-classic-1.1.3.jar logback-core-1.1.3.jar osgi-resource-locator-1.0.1.jar postgresql- 9.4-1201-jdbc41.jar reactor-core-1.1.4.RELEASE.jar slf4j-api-1.7.10.jar snakeyaml-1.12.jar spring-aop-4.1.6.RELEASE.jar spring- beans-4.1.6.RELEASE.jar spring-bridge-2.4.0-b10.jar spring-context-4.1.6.RELEASE.jar spring-core-4.1.6.RELEASE.jar spring-data- commons-1.10.0.RELEASE.jar spring-data-jpa-1.8.0.RELEASE.jar spring-expression-4.1.6.RELEASE.jar spring-integration-core- 4.1.2.RELEASE.jar spring-integration-jdbc-4.1.2.RELEASE.jar spring-jdbc-4.1.6.RELEASE.jar spring-messaging-4.1.4.RELEASE.jar spring-orm-4.1.6.RELEASE.jar spring-retry-1.1.1.RELEASE.jar spring-security-config-4.0.2.RELEASE.jar spring-security-core- 4.0.2.RELEASE.jar spring-security-web-4.0.2.RELEASE.jar spring-tx-4.1.6.RELEASE.jar spring-web-4.1.6.RELEASE.jar spring-webmvc- 4.1.6.RELEASE.jar swagger-annotations-1.5.3.jar swagger-core-1.5.3.jar swagger-models-1.5.3.jar tiger-types-1.4.jar unirest-java- 1.4.7.jar validation-api-1.1.0.Final.jar webservices-api-2.3.1.jar webservices-rt-2.3.1.jar wicket-auth-roles-7.0.0.jar wicket-core- 7.0.0.jar wicket-request-7.0.0.jar wicket-util-7.0.0.jar xml-apis-1.0.b2.jar
  • 28. Java 8: Jar/Classpath Hell antlr-2.7.7.jar aopalliance-1.0.jar aopalliance-repackaged-2.4.0-b10.jar asm-all-repackaged-2.4.0-b10.jar aspectjrt-1.8.5.jar aspectjweaver-1.8.5.jar bean-validator-2.4.0-b10.jar classmate-1.0.0.jar class-model-2.4.0-b10.jar commons-beanutils-1.9.2.jar commons-codec-1.10.jar commons-collections-3.2.1.jar commons-compiler-2.7.8.jar commons-dbcp-1.4.jar commons-fileupload- 1.3.1.jar commons-io-2.4.jar commons-lang3-3.2.1.jar commons-logging-1.1.1.jar commons-pool-1.5.4.jar config-types-2.4.0- b10.jar core-2.4.0-b10.jar db2jcc-4.0.jar disruptor-3.2.1.jar dom4j-1.6.1.jar gs-collections-5.1.0.jar gs-collections-api-5.1.0.jar gson-2.3.1.jar guava-18.0.jar hibernate-commons-annotations-4.0.5.Final.jar hibernate-core-4.3.10.Final.jar hibernate- entitymanager-4.3.10.Final.jar hibernate-jpa-2.1-api-1.0.0.Final.jar hibernate-validator-5.1.3.Final.jar hk2-2.4.0-b10.jar hk2-api- 2.4.0-b10.jar hk2-config-2.4.0-b10.jar hk2-locator-2.4.0-b10.jar hk2-runlevel-2.4.0-b10.jar hk2-utils-2.4.0-b10.jar httpasyncclient- 4.0.2.jar httpclient-4.3.6.jar httpcore-4.3.3.jar httpcore-nio-4.3.2.jar httpmime-4.3.6.jar jackson-annotations-2.4.5.jar jackson- core-2.4.5.jar jackson-databind-2.4.5.jar jackson-dataformat-yaml-2.4.5.jar jackson-datatype-joda-2.4.5.jar jandex-1.1.0.Final.jar janino-2.7.8.jar javaee-web-api-7.0.jar javassist-3.18.1-GA.jar javax.annotation-api-1.2.jar javax.inject-1.jar javax.inject-2.4.0- b10.jar javax.ws.rs-api-2.0.1.jar jboss-logging-3.1.3.GA.jar jboss-logging-annotations-1.2.0.Beta1.jar jboss-transaction- api_1.2_spec-1.0.0.Final.jar jcl-over-slf4j-1.7.10.jar jersey-client-2.17.jar jersey-common-2.17.jar jersey-container-servlet-core- 2.17.jar jersey-guava-2.17.jar jersey-media-jaxb-2.17.jar jersey-server-2.17.jar jersey-spring3-2.17.jar jldap-4.3.jar joda-time- 2.2.jar json-20140107.jar jsr166e-1.0.jar logback-classic-1.1.3.jar logback-core-1.1.3.jar osgi-resource-locator-1.0.1.jar postgresql- 9.4-1201-jdbc41.jar reactor-core-1.1.4.RELEASE.jar slf4j-api-1.7.10.jar snakeyaml-1.12.jar spring-aop-4.1.6.RELEASE.jar spring- beans-4.1.6.RELEASE.jar spring-bridge-2.4.0-b10.jar spring-context-4.1.6.RELEASE.jar spring-core-4.1.6.RELEASE.jar spring-data- commons-1.10.0.RELEASE.jar spring-data-jpa-1.8.0.RELEASE.jar spring-expression-4.1.6.RELEASE.jar spring-integration-core- 4.1.2.RELEASE.jar spring-integration-jdbc-4.1.2.RELEASE.jar spring-jdbc-4.1.6.RELEASE.jar spring-messaging-4.1.4.RELEASE.jar spring-orm-4.1.6.RELEASE.jar spring-retry-1.1.1.RELEASE.jar spring-security-config-4.0.2.RELEASE.jar spring-security-core- 4.0.2.RELEASE.jar spring-security-web-4.0.2.RELEASE.jar spring-tx-4.1.6.RELEASE.jar spring-web-4.1.6.RELEASE.jar spring-webmvc- 4.1.6.RELEASE.jar swagger-annotations-1.5.3.jar swagger-core-1.5.3.jar swagger-models-1.5.3.jar tiger-types-1.4.jar unirest-java- 1.4.7.jar validation-api-1.1.0.Final.jar webservices-api-2.3.1.jar webservices-rt-2.3.1.jar wicket-auth-roles-7.0.0.jar wicket-core- 7.0.0.jar wicket-request-7.0.0.jar wicket-util-7.0.0.jar xml-apis-1.0.b2.jar
  • 29. Java 9: No Classpath & Internal API -classpath -internal API
  • 34. Module module = A container of packages Module can exports specific package to all Module can exports specific package to specific module Module can import other module
  • 36. Modular Security Accessibility (Java 1 to 8) • public • protected • default • private
  • 37. Modular Security Accessibility (Java 9) • public – public to everyone – public, but only to specific modules – public only within a module • protected • default • private public ≠ accessible (fundamental change to Java)
  • 38. 4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. #DV13 #Jigsaw @mreinhold tls logging auth jdbc jta jaxpnaming rowset kerberos management compiler xmldsig crypto cosnaming management.iiop corba desktop tools.jre jaxws httpserverjavafx prefssctp jx.annotations instrument base 54MB 30 16 11 nashornscript rmi
  • 39. 4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. #DV13 #Jigsaw @mreinhold tls logging auth jdbc jta jaxpnaming rowset kerberos management compiler xmldsig crypto cosnaming management.iiop corba desktop tools.jre jaxws httpserver tools tools.jaxws tools.base devtools javafx prefssctp jx.annotations instrument base 54MB 30 16 11 nashornscript rmi
  • 40. 4 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. #DV13 #Jigsaw @mreinhold tls logging auth jdbc jta jaxpnaming rowset kerberos management compiler xmldsig crypto cosnaming management.iiop corba desktop tools.jre jaxws httpserver tools tools.jaxws tools.base devtools javafx prefssctp jx.annotations instrument base nashornscript rmi
  • 43. Modularity Demo module app { } nl/cimsolutions/Main.java module-info.java
  • 44. Modularity Demo module app { requires alpha; } app alpha
  • 45. Modularity Demo module app { requires alpha; requires java.desktop; } app alpha desktop
  • 46. Modularity Demo module alpha { exports org.forpublic; } alpha org.forpublic org.forinternal
  • 48. JDK Structure bin Pre-JDK 9 JDK 9 lib tools.jar jre bin rt.jar lib libconfbin jre directory tools.jar rt.jar
  • 49. JEP 222: jshell-The Java Shell (Read-Eval-Print Loop)
  • 50. What is jshell? • Tool providing a dynamic interaction with the Java™ programming language • Read-Evaluate-Print Loop (REPL) for the Java™ platform – Type in a snippet of Java code, see the results • Deeply integrated with JDK tool-set – Stays current and compatible • Also, an API for use within other applications
  • 51. What jshell is “Not”? • Not a new language – “Snippets” of pure • No new syntax • Not a replacement for the compiler • Not an IDE (Integrated Development Environment)
  • 52. Who wants jshell? • New to Java, new to programming – Start with expressions vs classes – Immediate feedback • Exploring a new API or language feature – Experiment and instantly see results • Prototyping – Incrementally write complex code
  • 53. Without jshell: Edit Compile Run • Write a full program: – Class – Imports – main method • Cycle the whole program to understand if the behavior is correct: – Edit – Compiler or IDE – Execute
  • 54. Without jshell: Edit Compile Run > edit Hello.java public class Hello { public static void main(String[] args) { System.out.println("Hello World"); } } > javac Hello.java > java Hello ………….. Repeat
  • 55. With jshell >jshell | Welcome to JShell -- Version 9-ea | For an introduction type: /help intro jshell> System.out.println("Hello World") Hello World
  • 57. JEP 269: Convenience Factory Methods for Collections
  • 58. New Collection API • Java Collection is verbose. • Ruby Collection: list = [1, 2, 3] set = Set.new [1, 2, 3] map = { ‘a’=> 1, ‘b’ => 2, ‘c’ => 3} • Java Collection: List<Integer> list = Arrays.asList(1, 2, 3); Set<Integer> set = new HashSet<>(Arrays.asList(1, 2, 3)); Map<String, Integer> map = new HashMap<>(); map.put(“a”,1); map.put(“b”,2); map.put(“c”,3);
  • 59. New Collection API • Java Collection is verbose. • Python Collection: list = [1, 2, 3] set = {1, 2, 3} map = { ‘a’ : 1, ‘b’ : 2, ‘c’ : 3} • Java Collection: List<Integer> list = Arrays.asList(1, 2, 3); Set<Integer> set = new HashSet<>(Arrays.asList(1, 2, 3)); Map<String, Integer> map = new HashMap<>(); map.put(“a”,1); map.put(“b”,2); map.put(“c”,3);
  • 60. New Collection API List<Integer> list = Arrays.asList(1, 2, 3); Set<Integer> set = new HashSet<>(Arrays.asList(1, 2, 3)); Map<String, Integer> map = new HashMap<>(); map.put(“a”,1); map.put(“b”,2); map.put(“c”,3); List<Integer> list = List.of(1, 2, 3); Set<Integer> set = Set.of(1, 2, 3); Map<String, Integer> map = Map.ofEntries(entry(“a”,1), entry(“b”,2), entry(“c”,3));
  • 61. G1 : New Garbage collector • Now GC is the default garbage collector. • In JDK 9, the G1 the default garbage collector. • Many performance improvements were made to G1 in JDK 8 and its update releases, and further improvements are planned for JDK 9. • The introduction of concurrent class unloading (JEP 156) in JDK 8u40 made G1 a fully-featured garbage collector, ready to be the default.
  • 62. HTML 5 and Javadoc Search • Enhance the javadoc tool to generate HTML5 markup. • Add a search box to generated API documentation that can be used to search for program elements and tagged words and phrases within the documentation.
  • 63. Deprecate the Applet API Add the @Deprecated(since="9") annotation to the following classes: • java.applet.AppletStub • java.applet.Applet • java.applet.AudioClip • java.applet.AppletContext • javax.swing.JApplet
  • 64. Process API Update • JEP 102: Process API Updates • New: – Get PID number from JVM – Get list of processes – Operations on tree of processes
  • 65. Process API Update Process proc = Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c", "echo $PPID"}); if (proc.waitFor() == 0) { InputStream in = proc.getInputStream(); int available = in.available(); byte[] outputBytes = new byte[available]; in.read(outputBytes); String pid = new String(outputBytes); System.out.println("Your pid is " + pid); } System.out.println("Your pid is " + ProcessHandle.current().getPid());
  • 66. Summary • Modularisation is a big change for Java – JVM/JRE rather than language/APIs – Public access isn’t necessarily the same • Flexibility to define what is exported • New linking capability to generate runtime image • More to learn about converting existing code • Will make all applications simpler to deploy and manage
  • 67. Q & A