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

Life Beyond Java 8 (July 2020)

Life Beyond Java 8 (July 2020)

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 14 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-14
- 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

July 10, 2020
Tweet

More Decks by Trisha Gee

Other Decks in Technology

Transcript

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

    Developer Advocate & Java Champion, JetBrains

    View Slide

  2. https://www.jetbrains.com/lp/devecosystem-2020/java/
    Despite the emergence of newer
    versions, Java 8 is still most
    beloved. It is used by 3/4 of Java
    developers. Java 11 is growing
    more popular. Compared to last
    year, its usage has increased by
    10 percentage points.

    View Slide

  3. https://www.infoq.com/news/2020/03/new-relic-jvm-report/ https://blog.newrelic.com/technology/state-of-java/
    “The majority of JVMs (over 85%) are running on Java 8”

    View Slide

  4. View Slide

  5. Releases, Updates, 

    Licensing & Support

    View Slide

  6. View Slide

  7. We have two types of releases

    View Slide

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

    View Slide

  9. View Slide

  10. $$$
    $$$

    View Slide

  11. $$$
    $$$

    View Slide

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

    View Slide

  13. Use $free Oracle OpenJDK

    View Slide

  14. Java 14

    View Slide

  15. Use $free Oracle OpenJDK
    But upgrade every 6 months

    View Slide

  16. Use an LTS version

    View Slide

  17. Java 11

    View Slide

  18. Use an LTS version
    But you may have to pay to use it in production

    View Slide

  19. https://jdk.dev

    View Slide

  20. View Slide

  21. Why bother?

    View Slide

  22. Java 11

    View Slide

  23. (Current LTS release)

    View Slide

  24. JShell

    View Slide

  25. var

    View Slide

  26. Convenience Factory Methods for
    Collections

    View Slide

  27. Collecting to Unmodifable Collections
    items.stream()

    .filter(Objects!::nonNull)

    .map(Object!::toString)

    .collect(Collectors.toUnmodifiableList());

    View Slide

  28. New Methods on Stream API
    items.stream()

    .takeWhile(user !-> user.count() < maxCount)

    .forEach(user !-> position.incrementAndGet());


    View Slide

  29. Predicate.not()

    View Slide

  30. New Methods on Optional

    View Slide

  31. Built in Http Client

    View Slide

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

    View Slide

  33. Jigsaw

    View Slide

  34. Java Module System

    View Slide

  35. JLink

    View Slide

  36. Java 14

    View Slide

  37. (The latest version)

    View Slide

  38. (for now!!...)

    View Slide

  39. https://blog.jetbrains.com/idea/2019/02/java-12-and-intellij-idea/
    Switch Expressions

    View Slide

  40. https://blog.jetbrains.com/idea/2019/11/java-13-and-intellij-idea
    Text Blocks (Preview)

    View Slide

  41. https://blog.jetbrains.com/idea/2020/03/java-14-and-intellij-idea/
    Pattern Matching for instanceof (Preview)

    View Slide

  42. https://blog.jetbrains.com/idea/2020/03/java-14-and-intellij-idea
    Records (Preview)

    View Slide

  43. Java 15

    View Slide

  44. JEP 378: Text Blocks (Standard)

    View Slide

  45. JEP 375: Pattern Matching for instanceof
    (Second Preview)

    View Slide

  46. • Non-private constructors
    • Annotations
    • Local Types
    JEP 384: Records (Second Preview)

    View Slide

  47. JEP 360: Sealed Types (Preview)

    View Slide

  48. JEP 371: Hidden Classes

    View Slide

  49. JEP 377: ZGC: A Scalable Low-Latency
    Garbage Collector (Production)

    View Slide

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

    View Slide

  51. The Future

    View Slide

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

    View Slide

  53. The Business
    Doesn’t Care About
    Language Features

    View Slide

  54. Performance

    View Slide

  55. Use of Memory

    View Slide

  56. • 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 Slide

  57. • Java 12: Shenandoah (Experimental)
    • Java 12: More Updates to G1
    • Java 12: More Improvements to ZGC
    • Java 13: ZGC: Uncommit Unused Memory
    • Java 14: ZGC on macOS and Windows
    • Java 14: Deprecate the ParallelScavenge +
    SerialOld GC Combination
    Garbage Collection (Java 14)

    View Slide

  58. Cost

    View Slide

  59. Cost
    £$€

    View Slide

  60. Tips for Migration

    View Slide

  61. Run on updated JDK

    View Slide

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

    View Slide

  63. Address compiler warnings

    View Slide

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

    View Slide

  65. Update your dependencies

    View Slide

  66. Update your dependencies
    And add new ones

    View Slide

  67. Update your build tool

    View Slide

  68. Update your build tool
    Updated Maven and Gradle required

    View Slide

  69. Compile against updated JDK

    View Slide

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

    View Slide

  71. https://www.infoq.com/articles/upgrading-java-8-to-12/

    View Slide

  72. In Summary

    View Slide

  73. Modern Java Can Help You

    View Slide

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

    View Slide

  75. There are two upgrade options

    View Slide

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

    View Slide

  77. Upgrade Now And Reduce Future
    Pain

    View Slide

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

    View Slide

  79. http://bit.ly/beyond-j8
    @trisha_gee

    View Slide