Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Life Beyond Java 8

Trisha Gee
December 03, 2020

Life Beyond Java 8

Wasn’t Java 8 a fantastic update to the language? Lambdas and streams were a huge change and have helped to improve Java developers’ productivity and introduce some functional ideas to the language. Then came Java 9... and although the module system is really interesting for certain types of applications, the lack of exciting language features and uncertainty around how painful it might be to migrate to Java 9 left many applications taking a wait-and-see approach, happy with Java 8.

But now Java has a new version every six months, and suddenly Java 15 is here. We’re all still on Java 8, wondering
whether we should move to a later version, which one to choose, and how painful it might be to upgrade.

In this session we’ll look at:

- Why upgrade from Java 8, including language features from Java 9-15
- What sorts of issues might we run into if we do choose to upgrade
- How the support and license changes that came in with Java 11 might impact us.

Trisha Gee

December 03, 2020
Tweet

More Decks by Trisha Gee

Other Decks in Programming

Transcript

  1. IntelliJ IDEA
    ©JetBrains. All rights reserved
    Life Beyond Java 8
    Trisha Gee (@trisha_gee)
    Java Developer Advocacy Lead, JetBrains

    View full-size slide

  2. https://blog.jetbrains.com/idea/2020/09/a-picture-of-java-in-2020/
    Java 8 remains the most popular version. It is used by 75% of professional
    developers who use Java as their primary language.

    View full-size slide

  3. https://www.infoq.com/news/2020/03/new-relic-jvm-report/ https://snyk.io/wp-content/uploads/jvm_2020.pdf
    “The majority of JVMs (over 85%) are running on Java 8”

    View full-size slide

  4. Releases, Updates,
    Licensing & Support

    View full-size slide

  5. We have two types of releases

    View full-size slide

  6. We have two types of releases
    Releases and LTS (Long Term Support) releases

    View full-size slide

  7. https://flic.kr/p/8xhk74

    View full-size slide

  8. Java 11
    Long Term Support (LTS) Release; ~3 years support

    View full-size slide

  9. Java 15
    Current release; be prepared to upgrade in March 2021

    View full-size slide

  10. https://jdk.dev

    View full-size slide

  11. IntelliJ IDEA can
    help you

    View full-size slide

  12. Java 11

    Long Term Support (LTS) Release

    View full-size slide

  13. Convenience Factory Methods for
    Collections

    View full-size slide

  14. Collecting to Unmodifable Collections
    items.stream()
    .filter(Objects!::nonNull)

    .map(Object!::toString)

    .collect(Collectors.toUnmodifiableList());

    View full-size slide

  15. New Methods on Stream API
    items.stream()
    .takeWhile(user !-> user.count() < maxCount)
    .forEach(user !-> position.incrementAndGet());

    View full-size slide

  16. Predicate.not()

    View full-size slide

  17. New Methods on Optional

    View full-size slide

  18. Built in Http Client

    View full-size slide

  19. • https://blog.jetbrains.com/idea/2017/10/creating-
    multi-release-jar-files-in-intellij-idea/
    Multi Release Jar Files

    View full-size slide

  20. Java Module System

    View full-size slide

  21. Java 15

    Current Release

    View full-size slide

  22. Switch Expressions

    View full-size slide

  23. Switch Expressions
    https://jb.gg/ij-jdk12

    View full-size slide

  24. Text Blocks
    https://jb.gg/ij-jdk13

    View full-size slide

  25. Hidden classes

    View full-size slide

  26. Hidden classes
    JEP 371

    View full-size slide

  27. A Scalable Low-Latency Garbage Collector

    View full-size slide

  28. A Scalable Low-Latency Garbage Collector
    JEP 377

    View full-size slide

  29. Preview Features

    View full-size slide

  30. Pattern Matching for instanceof

    View full-size slide

  31. Pattern Matching for instanceof
    https://jb.gg/ij-jdk14

    View full-size slide

  32. Records
    https://jb.gg/ij-jdk14

    View full-size slide

  33. Sealed Types

    View full-size slide

  34. Sealed Types
    https://jb.gg/ij-jdk15

    View full-size slide

  35. https://openjdk.java.net/projects/jdk/15/

    View full-size slide

  36. • JEP 302: Lambda Leftovers (including underscore for
    param)
    • JEP 360: Sealed Types (Preview)
    • JEP draft: Pattern matching for switch (Preview)
    • Project Amber
    • Valhalla
    • Loom
    • Lots of Garbage Collection improvements
    Java 16

    View full-size slide

  37. • Project Amber
    • Valhalla
    • Loom
    • More Garbage Collection improvements
    • Proposed New Project: Leyden
    And in the future?

    View full-size slide

  38. The Business
    Doesn’t Care About
    Language Features

    View full-size slide

  39. Use of Memory

    View full-size slide

  40. • Java 9: JEP 248: G1 the Default GC
    • Java 10: JEP 307: Parallel Full GC for G1
    • Java 11: JEP 318: Epsilon (Experimental)
    • Java 11: JEP 333: ZGC (Experimental)
    Garbage Collection (Java 11)

    View full-size slide

  41. • Java 12: More Updates to G1
    • Java 14: Deprecate the ParallelScavenge +
    SerialOld GC Combination
    • Java 15: ZGC (Production)
    • Java 15: Shenandoah (Production)
    Garbage Collection (Java 15)

    View full-size slide

  42. Tips for Migration

    View full-size slide

  43. Run on updated JDK

    View full-size slide

  44. Run on updated JDK
    It might “just work”

    View full-size slide

  45. Address compiler warnings

    View full-size slide

  46. Address compiler warnings
    …they are there for a reason

    View full-size slide

  47. Update your dependencies

    View full-size slide

  48. Update your dependencies
    And add new ones

    View full-size slide

  49. Update your build tool

    View full-size slide

  50. Update your build tool
    Updated Maven and Gradle required

    View full-size slide

  51. Compile against updated JDK

    View full-size slide

  52. Compile against updated JDK
    …and start using the shiny new features

    View full-size slide

  53. https://bit.ly/8-to-11

    View full-size slide

  54. Modern Java Can Help You

    View full-size slide

  55. Modern Java Can Help You
    Performance, cost, maintenance…

    View full-size slide

  56. There are two upgrade options

    View full-size slide

  57. There are two upgrade options
    To Java 11 (LTS) or to Java 15 (upgrade every 6 months)

    View full-size slide

  58. Upgrade Now And Reduce Future
    Pain

    View full-size slide

  59. Upgrade Now And Reduce Future
    Pain
    …and keep upgrading, at least in CI

    View full-size slide

  60. https://bit.ly/love-beyond-8
    @trisha_gee

    View full-size slide