The future of Java
Background: The Goal of JDK 9
Make Java SE more flexible and scalable
Improve security and maintainability
Make it easier to construct, maintain, deploy and
upgrade large applications
Enable improved performance
Schedule
26.05.16 Feature Complete
11.08.16 All Tests Run
01.09.16 Rampdown Start
20.10.16 Zero Bug Bounce
01.12.16 Rampdown Phase 2
26.01.17 Final Release Candidate
23.03.17 General Availability
Changes
API changes
Internal changes
Security
Tools
VM
Jigsaw
misc
More Concurrency Updates
Stack-walking API
Process API updates
HTTP/2 Client
Platform Logging API and Sevices
Enhanced Method Handles
Variable Handles
Milling Project Coin
Factory methods for Collections
API Changes
More Concurrency Updates (JEP 266)
Basic support for Reactive Streams (Flow and
SubmissionPublisher API)
CompletableFuture enhancements
○ Support delays and timeouts
○ Better support for subclassing
○ Few utility methods
Merge JSR 166 implementation to JDK with all the
improvements.
Stack-Walking API (JEP 259)
Provide a way to walk through Stacktraces with filtering,
lazy access to elements. New API:
instead of existing
internal API (sun.reflect.Reflection.getCallerClass)
Process API Update (JEP 102)
Enhance Process API to control native OS processes. API:
ProcessHandle to access system processes not spawned by the API
Updates to Process to link to
Security provisions to control access to
Information about the children of a process, direct and indirect
Optional Information (based on OS availability) about a process including
command, arguments, start time, and cputime
HTTP/2 Client (JEP 110)
Create a new API to replace existing HttpURLConnection API
with following improvements:
Support asynchronous calls
Support WebSocket protocol
Support HTTP/2 a s well as HTTP 1.0 and HTTP 1.1
Enhanced Method Handles (JEP 274)
Create new ’s which will allow to create the
following constructs:
Loops
Try/finally blocks
Class lookup
Build MethodHandle fro non-abstract methods in interfaces
Better argument handling(spreading, collecting)
Variable Handles (JEP 193)
Currently is under construction and not available in JDK9 EA
Replace CAS operations from
Provide better performance comparing to
.
Milling Project
Coin (JEP 213)
Underscore no more legal
identifier name!
Milling Project Coin (JEP 213)
Now Would be
Milling Project Coin (JEP 213)
Allow diamond with anonymous classes if the argument
type of the inferred type is denotable
private methods in interfaces
Milling Project Coin
(JEP 213)
static methods in interfaces for free!
Convenience Factory Methods for
Collections (JEP 269)
All of them are static interface methods.
Internal Changes
Compact Strings
UTF-8 property files
Elide deprecation warnings on imports
Use CLDR by default
Improve contended locking
Update Xerx version in JDK to 2.11
Unicode-8
Resolve lint and doclint warnings in JDK sourcebase
Security
DRBG-based SecureRandom implementation
DTLS (Datagram Transport Layer Security)
Improve Secure Application Performance
Create Keystores by Default
Tools
JavaDoc
■ JavaDoc search
■ HTML5
■ Simplified Doclet API
JMH and harness test coverage
JShell
javac
■ Smart java compilation. Phase 2
■ Annotation pipeline 2.0
■ Tiered attribution to javac
■ Process import statements correctly
VM
New versioning scheme
Make G1 the Default Garbage Collector
Reserved stack areas for critical sections
Unified logging (VM/GC)
Segmented code cache
Remove GC combinations deprecated in JDK #8
Compiler control
Misc
Almost related to UI and Java 2D changes.
Platform-specific desktop features
Jigsaw
JEP 200: Modular JDK (Define the modules of JDK and their structure)
JEP 201: Modular Source code (reorganize JDK source code into a
modules, adjust compilers)
JEP 220: Modular Runtime Images
JEP 260: Encapsulate most internal API (The famous one thanks to
sun.misc.Unsafe)
JEP 261: Modular system (The implementations of JSR 376 )
Modular JDK
(JEP 260) Encapsulate most internal API
Encapsulate all non-critical internal APIs by default
Encapsulate all critical internal APIs for which supported
replacements exist in JDK 8
Do not encapsulate critical internal APIs
Deprecate them in JDK 9
Plan to remove in JDK 10
Provide a workaround via command-line flag
(JEP 260) Encapsulate most internal API
(Most functionality now available via
)
(Now
available via Stack-Walking API)
(JEP 260) Check the compatibility
Maven JDeps plugin
jdeps tool in JDK8 and improved in JDK9
> jdeps -jdkinternals .
-> jdk.scripting.nashorn
com.foo.bar.baz.client.BonusTotalsByNetworksTest (.)
-> jdk.nashorn.internal.ir.annotations.Ignore JDK internal API (jdk.scripting.
nashorn)
What is Module?
com.foo.bar
Code and Data
Declaration of what it exposes
Declaration of what it requires
Module Declaration
module-info.java
com.foo.bar
Code and Data
Declaration of what it exposes
Declaration of what it requires
Module Graph
com.foo.bar
com.foo.baz
java.base
java.sql
java.logging
Readability
com.foo.bar
Code and Data
requires com.foo.baz;
com.foo.baz
Code and Data
provides com.foo.baz.api;
Reads
No more public as it was before
Now
● public
● protected
● <default>
● private
Will be
● public for everyone
● public for specified
● public only within the module
● protected
● <default>
● private
Transitive dependencies
com.foo.bar
com.foo.baz
java.base
java.sql
java.logging
package com.sql;
public interface .Driver {
…..
Logger getParentLogger() …
..…
}
module java.sql {
requires …..
…….
requires public java.logging;
……..
}
Summary
Forget anything you’ve learnt about interfaces in Java
Make sure your code is compliant to JDK 9 changes
○ jdeps for the rescue
○ remove single underscore symbol identifiers
Look forward next session about Jigsaw!
Thanks for your attention!
Q/A?

Illia shestakov - The Future of Java JDK #9

  • 1.
  • 2.
    Background: The Goalof JDK 9 Make Java SE more flexible and scalable Improve security and maintainability Make it easier to construct, maintain, deploy and upgrade large applications Enable improved performance
  • 3.
    Schedule 26.05.16 Feature Complete 11.08.16All Tests Run 01.09.16 Rampdown Start 20.10.16 Zero Bug Bounce 01.12.16 Rampdown Phase 2 26.01.17 Final Release Candidate 23.03.17 General Availability
  • 4.
  • 5.
    More Concurrency Updates Stack-walkingAPI Process API updates HTTP/2 Client Platform Logging API and Sevices Enhanced Method Handles Variable Handles Milling Project Coin Factory methods for Collections API Changes
  • 6.
    More Concurrency Updates(JEP 266) Basic support for Reactive Streams (Flow and SubmissionPublisher API) CompletableFuture enhancements ○ Support delays and timeouts ○ Better support for subclassing ○ Few utility methods Merge JSR 166 implementation to JDK with all the improvements.
  • 7.
    Stack-Walking API (JEP259) Provide a way to walk through Stacktraces with filtering, lazy access to elements. New API: instead of existing internal API (sun.reflect.Reflection.getCallerClass)
  • 8.
    Process API Update(JEP 102) Enhance Process API to control native OS processes. API: ProcessHandle to access system processes not spawned by the API Updates to Process to link to Security provisions to control access to Information about the children of a process, direct and indirect Optional Information (based on OS availability) about a process including command, arguments, start time, and cputime
  • 9.
    HTTP/2 Client (JEP110) Create a new API to replace existing HttpURLConnection API with following improvements: Support asynchronous calls Support WebSocket protocol Support HTTP/2 a s well as HTTP 1.0 and HTTP 1.1
  • 10.
    Enhanced Method Handles(JEP 274) Create new ’s which will allow to create the following constructs: Loops Try/finally blocks Class lookup Build MethodHandle fro non-abstract methods in interfaces Better argument handling(spreading, collecting)
  • 11.
    Variable Handles (JEP193) Currently is under construction and not available in JDK9 EA Replace CAS operations from Provide better performance comparing to .
  • 12.
    Milling Project Coin (JEP213) Underscore no more legal identifier name!
  • 13.
    Milling Project Coin(JEP 213) Now Would be
  • 14.
    Milling Project Coin(JEP 213) Allow diamond with anonymous classes if the argument type of the inferred type is denotable
  • 15.
    private methods ininterfaces Milling Project Coin (JEP 213) static methods in interfaces for free!
  • 16.
    Convenience Factory Methodsfor Collections (JEP 269) All of them are static interface methods.
  • 17.
    Internal Changes Compact Strings UTF-8property files Elide deprecation warnings on imports Use CLDR by default Improve contended locking Update Xerx version in JDK to 2.11 Unicode-8 Resolve lint and doclint warnings in JDK sourcebase
  • 18.
    Security DRBG-based SecureRandom implementation DTLS(Datagram Transport Layer Security) Improve Secure Application Performance Create Keystores by Default
  • 19.
    Tools JavaDoc ■ JavaDoc search ■HTML5 ■ Simplified Doclet API JMH and harness test coverage JShell javac ■ Smart java compilation. Phase 2 ■ Annotation pipeline 2.0 ■ Tiered attribution to javac ■ Process import statements correctly
  • 20.
    VM New versioning scheme MakeG1 the Default Garbage Collector Reserved stack areas for critical sections Unified logging (VM/GC) Segmented code cache Remove GC combinations deprecated in JDK #8 Compiler control
  • 21.
    Misc Almost related toUI and Java 2D changes. Platform-specific desktop features
  • 22.
    Jigsaw JEP 200: ModularJDK (Define the modules of JDK and their structure) JEP 201: Modular Source code (reorganize JDK source code into a modules, adjust compilers) JEP 220: Modular Runtime Images JEP 260: Encapsulate most internal API (The famous one thanks to sun.misc.Unsafe) JEP 261: Modular system (The implementations of JSR 376 )
  • 23.
  • 24.
    (JEP 260) Encapsulatemost internal API Encapsulate all non-critical internal APIs by default Encapsulate all critical internal APIs for which supported replacements exist in JDK 8 Do not encapsulate critical internal APIs Deprecate them in JDK 9 Plan to remove in JDK 10 Provide a workaround via command-line flag
  • 25.
    (JEP 260) Encapsulatemost internal API (Most functionality now available via ) (Now available via Stack-Walking API)
  • 26.
    (JEP 260) Checkthe compatibility Maven JDeps plugin jdeps tool in JDK8 and improved in JDK9 > jdeps -jdkinternals . -> jdk.scripting.nashorn com.foo.bar.baz.client.BonusTotalsByNetworksTest (.) -> jdk.nashorn.internal.ir.annotations.Ignore JDK internal API (jdk.scripting. nashorn)
  • 27.
    What is Module? com.foo.bar Codeand Data Declaration of what it exposes Declaration of what it requires
  • 28.
    Module Declaration module-info.java com.foo.bar Code andData Declaration of what it exposes Declaration of what it requires
  • 29.
  • 30.
    Readability com.foo.bar Code and Data requirescom.foo.baz; com.foo.baz Code and Data provides com.foo.baz.api; Reads
  • 31.
    No more publicas it was before Now ● public ● protected ● <default> ● private Will be ● public for everyone ● public for specified ● public only within the module ● protected ● <default> ● private
  • 32.
    Transitive dependencies com.foo.bar com.foo.baz java.base java.sql java.logging package com.sql; publicinterface .Driver { ….. Logger getParentLogger() … ..… } module java.sql { requires ….. ……. requires public java.logging; …….. }
  • 33.
    Summary Forget anything you’velearnt about interfaces in Java Make sure your code is compliant to JDK 9 changes ○ jdeps for the rescue ○ remove single underscore symbol identifiers Look forward next session about Jigsaw! Thanks for your attention!
  • 34.