$30 off During Our Annual Pro Sale. View Details »

9 Lives of Java 9

Tomasz Borek
December 18, 2016

9 Lives of Java 9

Not a simple "what's new", since I'm also examining history of the language, trying to show what led to current state and Jigsaw being necessary.

This includes new announcements about JDK 18.03, JDK10, new Java release cadence, Java EE and all recent (and not so recent) highlights showing I was right speaking about Java transition.

If time permits, there's also trivia game and demo.

Tomasz Borek

December 18, 2016
Tweet

More Decks by Tomasz Borek

Other Decks in Technology

Transcript

  1. 9 Lives of Java 9
    @LAFK_pl Consultant @

    View Slide

  2. Thank you @ccoenraets
    https://ccoenraets.github.io/react-trivia/

    View Slide

  3. About me
    @LAFK_pl
    Consultant @
    Tomasz Borek

    View Slide

  4. Currently

    Kraków

    Newbies or juniors

    3-5 months

    To programmers

    Or as close as I can

    With JS, QA, etc.

    4th edition Nov 2017

    View Slide

  5. 1st Life
    @LAFK_pl Consultant @

    View Slide

  6. Oak – The Green Platform

    View Slide

  7. The Green Team

    View Slide

  8. Green project

    The Green Team

    Smart appliances

    C++ extension → Oak →
    Green Platform (and
    OS)→ Java

    Star 7 (summer 1992)

    View Slide

  9. Green project

    View Slide

  10. Star 7 home entertainment system

    Star 7 (summer 1992)

    View Slide

  11. The Duke Mascott

    Star 7 (summer 1992)

    View Slide

  12. Ends because...

    Too much control in hands of the users
    – Cable TV industry wants dumber remotes

    PDAs didn’t quite took off

    Instead, World Wide Web did
    – Hence, WebRunner → HotJava, browser
    – Appropriate interactivity
    – 1994 – retargeting to WWW
    – 1995 – HotJava
    – 1996...

    View Slide

  13. 2nd Life
    @LAFK_pl Consultant @
    January 23, 1996

    View Slide

  14. Java – JDK 1.02

    View Slide

  15. View Slide

  16. View Slide

  17. View Slide

  18. Java – JDK 1.02

    View Slide

  19. WORA

    JIT (Just In Time) compiler for Windows

    Network byte order

    So, all that to run C code?

    View Slide

  20. JDK 1.02, first Java

    AWT event model

    Inner classes

    JavaBeans

    JDBC

    RMI

    Reflection
    (introspection only,
    TBH)

    GC

    VM

    MCM (green threads)

    Sandbox
    February 19, 1997

    View Slide

  21. 3rd Life
    @LAFK_pl
    December 8, 1998 Consultant @

    View Slide

  22. Playground

    View Slide

  23. Playground

    Tripled in size

    Introduced JCF

    strictfp keyword

    Swing graphical API

    Sun’s JVM had a JIT
    compiler now

    Java plug-in

    View Slide

  24. View Slide

  25. Enterprise

    Lovely Sun marketing
    – SE, ME, EE

    Enterprise rulz
    – J2EE :-)

    EJBOSS

    Standards are hard

    Desktop? Forget it!

    View Slide

  26. 4th Life? Nah, just growth
    @LAFK_pl
    May 8, 2000 Consultant @

    View Slide

  27. Spreading the wings

    Kestrel (1.3, right) – improvements everywhere
    (PermGen, HotSpot JVM). JNDI and JPDA though!

    Merlin had APIs and libs: NIO, JAXP, Logging, JDBC
    3, Preferences, Ipv6, RegEx, Images. Plus Java Web
    Start, assert and chaining exceptions.

    View Slide

  28. First community edition

    As JSR-59

    Java Community
    Process

    February 6th, 2002

    View Slide

  29. 4th Life
    @LAFK_pl
    September 30, 2004 Consultant @

    View Slide

  30. Tiger

    Majority of interview
    questions
    – Next big thing is JDK8

    Enum, annotations,
    generics, foreach,
    varargs, auto-/un-
    boxing, concurrency,
    scanner...

    Improved JMCM!

    View Slide

  31. Un-Life
    @LAFK_pl
    Till, 2012 or so Consultant @

    View Slide

  32. Mustang and Dolphin

    Invokedynamic

    64bit pointers

    Coin

    8 and 9

    perf

    JVM perf

    GUI (Swing)

    javac, JDBC 4, JAXB 2
    http://openjdk.java.net/projects/coin/

    View Slide

  33. Ends because...

    Too much chaos in marketing

    Too much problems with enterprise

    View Slide

  34. RIP
    October 08, 2013:
    if Java is dying, it sure looks awfully healthy

    View Slide

  35. Game changers

    View Slide

  36. Current Life (5th)
    @LAFK_pl
    March 18, 2014
    September 21, 2017 Consultant @
    JDK 8

    View Slide

  37. So, JDK 8 JEPS?
    55 all together
    GA on 14th March 2014
    Maurice Naftalin Lambda FAQ

    View Slide

  38. JDK 8: λ and Streams
    JSR-335: Lambda
    expressions
    Streams
    Conc. &
    Parallelism

    View Slide

  39. Project λ

    Functions are first-class citizens (almost)
    – Anonymous classes still but
    – Function interface
    – @FunctionalInterface

    Method refs

    Change your thinking

    Immutability, effectively final vars

    Coupled with streams

    View Slide

  40. Project λ + Streams

    Functions are first-class citizens (almost)
    – Anonymous classes still but
    – Function interface
    – @FunctionalInterface

    Method refs

    Change your thinking

    Immutability, effectively final vars

    Coupled with streams

    View Slide

  41. Jigsaw and modularity

    View Slide

  42. So, JDK 9 JEPS?
    91 all together
    GA on 21st September 2017
    lafk.pl/jdk9-on-jdd/

    View Slide

  43. Project Kulla = JShell

    222: jshell – the Java shell (REPL)

    Kulla – builder god, banished when done

    https://docs.oracle.com/javase/9/tools/jshell.htm

    /aCommand → /exit /help intro /help shortcuts

    /list

    /save

    /open some-jshell-file.jsh

    View Slide

  44. Project Kulla = JShell

    222: jshell – the Java shell (REPL)

    Features Tab-completion, quite nice at that!

    Jline uses C readline lib

    Look for ~/.inputrc or /etc/input.rc

    View Slide

  45. Project Kulla = JShell

    Build web-app with REPL with Kuba Marchwicki

    View Slide

  46. Project Jigsaw

    JAR hell, classpath loading problems

    JARs are not components, they are files

    JDK and most Java apps are monoliths

    JDK weighs a lot

    Your Java app weighs a lot

    µservices aren’t monolithic (shouldn’t be!)

    Game changers!

    View Slide

  47. Project Jigsaw

    Rabea Gransberger – refactor to modules

    Mark Reinhold – State of the modules system
    – http://openjdk.java.net/projects/jigsaw/spec/sotms/
    – Java One sessions

    My own 9 Lives of Java 9
    – https://github.com/LIttleAncientForestKami/j9-intro

    http://openjdk.java.net/projects/jigsaw

    View Slide

  48. Project Jigsaw - JEPs

    162: Prepare for Modularisation

    200: The Modular JDK

    201: Modular Source Code (Jigsaw itself)

    220: Modular Run-Time images
    – Standard class libraries modularised (rt.jar)
    – Files more efficient than JAR

    260: Most internal APIs now encapsulated
    – Unsafe, VarHandles, MethodHandles

    275: java packager

    282: jlink, Java linker
    7 in
    total

    View Slide

  49. Modules in a nutshell

    Base always present

    Requires – modules you need

    Exports – what you publish (here public matters)

    Use – required services – via ServiceLoader

    http://cr.openjdk.java.net/~mr/jigsaw/jdk9-module-summary.html

    https://bugs.openjdk.java.net/secure/attachment/72525/jdk.png

    module-info.java, module path

    jlink, jdepend

    https://github.com/accso/java9-jigsaw-depvis

    View Slide

  50. Modules in a nutshell

    http://cr.openjdk.java.net/~mr/jigsaw/jdk9-module-summary.html

    https://bugs.openjdk.java.net/secure/attachment/72525/jdk.png

    View Slide

  51. Default GC is G1

    JEP 248

    CMS deprecated
    – ParNew as well

    Regions, categorized

    Huge objects

    JEPs:
    – 250: Strings in CDSes
    – 214: remove deprecated
    combinations

    Not for small heaps

    String Deduplication
    – JEP 192, 8u20

    View Slide

  52. Unicode, Javadoc, Nashorn

    221: Simplified Doclet API

    224: HTML5 Javadoc

    225: Javadoc Search

    226: UTF-8 Property Files

    267: Unicode 8.0 (7,3k+)

    227: Unicode 7.0 (2,8k+)

    236: Parser API for Nashorn

    252: Use CLDR Locale Data by Default

    292: Implement Selected ECMAScript 6 Features in Nashorn
    9 in
    total

    View Slide

  53. JEP 266: More concurrent updates

    java.util.concurrent.Flow
    – Reactive programming
    – http://www.reactive-streams.org/ - de-facto standard
    – PubSub:

    CompleteableFuture (20 or so changes)
    – http://www.baeldung.com/java-9-completablefuture

    View Slide

  54. Things will be removed!

    277: Enhanced Deprecation

    289: Deprecate the Applet API
    – forRemoval set to false

    214: Remove GC Combinations Deprecated in JDK 8

    231: Remove Launch-Time JRE Version Selection

    240: Remove the JVM TI hprof Agent

    241: Remove the jhat Tool

    298: Remove Demos and Samples
    5 in total

    View Slide

  55. Security

    219: Datagram Transport Layer Security (DTLS)

    229: Create PKCS12 Keystores by Default

    244: TLS Application-Layer Protocol Negotiation Extension

    249: OCSP Stapling for TLS

    273: DRBG-Based SecureRandom Implementations

    287: SHA-3 Hash Algorithms

    288: Disable SHA-1 Certificates

    290: Filter Incoming Serialization Data
    8 in total
    Another 8 in perf

    View Slide

  56. Libraries changes

    255: Merge Selected Xerces 2.11.0 Updates
    into JAXP

    259: Stack-Walking API

    260: Encapsulate Most Internal APIs

    266: More Concurrent Updates

    269: Convenience Factory Methods for
    Collections
    5 selected

    View Slide

  57. JVM changes

    193: Variable Handles

    245: Validate JVM Command-Line
    Flag Arguments

    228: Add More Diagnostic
    Commands

    238: Multi-Release JAR Files

    247: Compile for Older Platform
    Versions

    223: New Version-String Scheme

    217: Annotations Pipeline 2.0

    280: Indify String Concatenation

    272: Platform-Specific Desktop
    Features
    Whopping
    32
    in total

    233: Generate Run-Time Compiler
    Tests Automatically

    235: Test Class-File Attributes
    Generated by javac

    211: Elide Deprecation Warnings on
    Import Statements

    212: Resolve Lint and Doclint
    Warnings

    216: Process Import Statements
    Correctly

    279: Improve Test-Failure
    Troubleshooting

    281: HotSpot C++ Unit-Test
    Framework

    284: New HotSpot Build System

    248: Make G1 the Default Garbage
    Collector

    278: Additional Tests for
    Humongous Objects in G1

    243: Java-Level JVM Compiler
    Interface

    270: Reserved Stack Areas for
    Critical Sections

    274: Enhanced Method Handles

    237: Linux/AArch64 Port

    158: Unified JVM Logging

    264: Platform Logging API and
    Service

    271: Unified GC Logging

    165: Compiler Control

    View Slide

  58. So...?

    Jigsaw and modularity
    – Image, modules, JAR replace, linking, deps finding

    JVM
    – tooling, ground work (CLI, GC, String indify),

    APIs
    – JShell, Stack Walking, Process, Flow

    Performance, Security

    Why?

    View Slide

  59. In short

    Java went like a river, changing directions
    – Smart appliances → net → EE → SE → FP
    – Devs see language changes, but there’s more

    IoT, Big Data, Cloud (hence: FP, modularity)

    Jigsaw is the theme, but foundations improved!
    – JDK, perf, Strings, compiler, GC, tooling
    – Stack, Process, Jshell, Xerces, Flow

    View Slide

  60. Java EE
    – Not J2EE, not anymore

    Waited for JDK9 and Jigsaw

    Folks moved ahead though (without Oracle)
    – EE Guardians (https://javaee-guardians.io/)
    – MicroProfile (http://microprofile.io/)
    – Spring and container/server vendors

    Good summary
    – https://www.infoq.com/news/2017/04/long-road-for-java-ee-8

    Donated to Eclipse Foundation!

    View Slide

  61. 9 Lives of Java 9
    @LAFK_pl
    Now it will move faster!
    4 remain!
    Consultant @

    View Slide

  62. Java 18.03

    Every quarter (first month): bug fixes and
    patches

    Every March – feature release

    Every September – LTS feature release
    – LTS – 3 years

    https://mreinhold.org/blog/forward-faster

    View Slide

  63. JDK 10 JEPs

    286: Local-Variable Type Inference

    296: Consolidate the JDK Forest into a Single Repository

    304: Garbage-Collector Interface

    307: Parallel Full GC for G1

    310: Application Class-Data Sharing

    312: Thread-Local Handshakes

    313: Remove the Native-Header Generation Tool (javah)

    314: Additional Unicode Language-Tag Extensions

    316: Heap Allocation on Alternative Memory Devices

    317: Experimental Java-Based JIT Compiler

    319: Root Certificates

    322: Time-Based Release Versioning
    http://openjdk.java.net/projects/jdk/10/#Schedule

    View Slide

  64. Minor JDK10 JEPs

    286: Local-Variable Type Inference

    296: Consolidate the JDK Forest into a Single Repository

    304: Garbage-Collector Interface

    307: Parallel Full GC for G1

    310: Application Class-Data Sharing

    312: Thread-Local Handshakes

    313: Remove the Native-Header Generation Tool (javah)

    314: Additional Unicode Language-Tag Extensions

    316: Heap Allocation on Alternative Memory Devices

    317: Experimental Java-Based JIT Compiler

    319: Root Certificates

    322: Time-Based Release Versioning
    http://openjdk.java.net/projects/jdk/10/#Schedule

    View Slide

  65. GC JDK10 JEPs

    286: Local-Variable Type Inference

    296: Consolidate the JDK Forest into a Single Repository

    304: Garbage-Collector Interface

    307: Parallel Full GC for G1

    310: Application Class-Data Sharing

    312: Thread-Local Handshakes

    313: Remove the Native-Header Generation Tool (javah)

    314: Additional Unicode Language-Tag Extensions

    316: Heap Allocation on Alternative Memory Devices

    317: Experimental Java-Based JIT Compiler

    319: Root Certificates

    322: Time-Based Release Versioning
    http://openjdk.java.net/projects/jdk/10/#Schedule

    View Slide

  66. GC JDK10 JEPs

    304: Garbage-Collector Interface

    307: Parallel Full GC for G1

    316: Heap Allocation on Alternative Memory
    Devices
    – -XX:AllocateHeapAt=
    – NVDIMM, non-DRAM with DRAM semantics
    – Lower priority, larger capacity (than DRAM)

    View Slide

  67. GC JDK10 JEPs

    304: Garbage-Collector Interface

    307: Parallel Full GC for G1
    – -XX:ParallelGCThreads=
    – Affects Young and Mixed
    – ParallelGC has parallel full GC, so G1 should too

    Now it’s single threaded

    316: Heap Allocation on Alternative Memory
    Devices

    View Slide

  68. GC JDK10 JEPs

    304: Garbage-Collector Interface
    – Core reorganization
    – In future: Epsilon

    307: Parallel Full GC for G1

    316: Heap Allocation on Alternative Memory
    Devices

    View Slide

  69. JDK 10 minor JEPs

    296: Consolidate the JDK Forest into a Single
    Repository

    310: Application Class-Data Sharing

    313: Remove the Native-Header Generation Tool
    (javah)

    314: Additional Unicode Language-Tag Extensions

    319: Root Certificates

    322: Time-Based Release Versioning

    View Slide

  70. JEP-310: AppCDS

    Since Tiger we can share class data (CDS)
    – Only null class loader
    – Set of classes → mem-mapped archive
    – Such archive can be shared across JVMs

    AppCDS:
    – System class loader (and custom ones)
    – java -Xshare:off -XX:+UseAppCDS
    -XX:DumpLoadedClassList=hello.lst -cp hello.jar
    HelloWorld

    View Slide

  71. JEP-313: remove javah

    javah generates native header

    No longer used in JDK or during builds

    javac (since JDK8) can write native header files
    (during compilation)

    javac has API access through Compiler API or
    java.util.spi.ToolProvider – javah does not

    Ergo - removal

    View Slide

  72. JDK 10 minor JEPs

    296: Consolidate the JDK Forest into a Single
    Repository

    310: Application Class-Data Sharing

    313: Remove the Native-Header Generation Tool
    (javah)

    314: Additional Unicode Language-Tag Extensions

    319: Root Certificates

    322: Time-Based Release Versioning

    View Slide

  73. JEP-319: root certificates

    Root cacerts keystore should have root certs

    OpenJDK cacerts store is empty

    Oracle JDK is not

    This JEP makes 17 companies that signed
    OCA open-source their root certs
    – TLS works from the start with it
    http://openjdk.java.net/jeps/319

    View Slide

  74. Version string
    ➜ ~ /usr/lib/jvm/java-9-openjdk-amd64/bin/java -version
    openjdk version "9-internal"
    OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-
    195246.buildd.src)
    OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-
    195246.buildd.src, mixed mode)
    ➜ ~ java -version
    java version "1.8.0_101"
    Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed
    mode)

    View Slide

  75. Version string after JEP-223
    // JDK 9, build 165, early access
    ➜ /tmp/jdk-9/bin/java -version
    java version "9-ea"
    Java(TM) SE Runtime Environment (build 9-
    ea+165)
    Java HotSpot(TM) 64-Bit Server VM (build 9-
    ea+165, mixed mode)

    View Slide

  76. Version string after JEP-322
    //build 13 JDK 10.0.1
    $ java --version
    openjdk 10.0.1 2018-04-19
    OpenJDK Runtime Environment (build 10.0.1+13)
    OpenJDK 64-Bit Server VM (build 10.0.1+13, mixed mode)
    //build 42 JDK 11 LTS
    $ java --version
    openjdk 11 2018-09-20 LTS
    OpenJDK Runtime Environment (build 11+42-LTS)
    OpenJDK 64-Bit Server VM (build 11+42-LTS, mixed mode)

    View Slide

  77. Exciting JDK 10 JEPs

    286: Local-Variable Type Inference

    296: Consolidate the JDK Forest into a Single Repository

    304: Garbage-Collector Interface

    307: Parallel Full GC for G1

    310: Application Class-Data Sharing

    312: Thread-Local Handshakes

    313: Remove the Native-Header Generation Tool (javah)

    314: Additional Unicode Language-Tag Extensions

    316: Heap Allocation on Alternative Memory Devices

    317: Experimental Java-Based JIT Compiler

    319: Root Certificates

    322: Time-Based Release Versioning
    http://openjdk.java.net/projects/jdk/10/#Schedule

    View Slide

  78. Exciting JDK 10 JEPs

    286: Local-Variable Type Inference
    – var list = new ArrayList();

    // infers ArrayList
    – var stream = list.stream();

    // infers Stream
    – Only in for loops (both) and method locals

    312: Thread-Local Handshakes
    – Inspect one thread at a time, less ‘safepointing’

    317: Experimental Java-Based JIT Compiler
    – Graal, JIT done in Java, works on ASTs
    http://openjdk.java.net/projects/jdk/10/#Schedule

    View Slide

  79. In short

    Java went like a river, changing directions
    – Smart appliances → net → EE → SE → FP
    – You see where language changes, but there’s more

    IoT, Big Data, Cloud (hence: FP, modularity)

    Jigsaw is the theme, but foundations improved!

    Transition has only began! JDK10, 11…

    View Slide

  80. 9 Lives of Java 9
    @LAFK_pl
    21st September 2017 GA
    March 2018 JDK 10!
    At least 4 remain!
    Consultant @

    View Slide