Life Beyond Java 8

3d6ace9554821d552146413bcdf874f6?s=47 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.

3d6ace9554821d552146413bcdf874f6?s=128

Trisha Gee

December 03, 2020
Tweet

Transcript

  1. IntelliJ IDEA ©JetBrains. All rights reserved Life Beyond Java 8

    Trisha Gee (@trisha_gee) Java Developer Advocacy Lead, JetBrains
  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.
  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”
  4. Releases, Updates, Licensing & Support

  5. None
  6. We have two types of releases

  7. We have two types of releases Releases and LTS (Long

    Term Support) releases
  8. None
  9. $$$ $$$

  10. $$$ $$$

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

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

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

    2021
  14. https://jdk.dev

  15. IntelliJ IDEA can help you

  16. None
  17. Why bother?

  18. Java 11 Long Term Support (LTS) Release

  19. JShell

  20. var

  21. Convenience Factory Methods for Collections

  22. Collecting to Unmodifable Collections items.stream() .filter(Objects!::nonNull) .map(Object!::toString) .collect(Collectors.toUnmodifiableList());

  23. New Methods on Stream API items.stream() .takeWhile(user !-> user.count() <

    maxCount) .forEach(user !-> position.incrementAndGet());
  24. Predicate.not()

  25. New Methods on Optional

  26. Built in Http Client

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

  28. Jigsaw

  29. Java Module System

  30. JLink

  31. Java 15 Current Release

  32. Switch Expressions

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

  34. Text Blocks

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

  36. Hidden classes

  37. Hidden classes JEP 371

  38. A Scalable Low-Latency Garbage Collector

  39. A Scalable Low-Latency Garbage Collector JEP 377

  40. Preview Features

  41. Pattern Matching for instanceof

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

  43. Records

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

  45. Sealed Types

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

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

  48. The Future

  49. • 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
  50. • Project Amber • Valhalla • Loom • More Garbage

    Collection improvements • Proposed New Project: Leyden And in the future?
  51. The Business Doesn’t Care About Language Features

  52. Performance

  53. Use of Memory

  54. • 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)
  55. • 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)
  56. Cost

  57. Cost £$€

  58. Tips for Migration

  59. Run on updated JDK

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

  61. Address compiler warnings

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

  63. Update your dependencies

  64. Update your dependencies And add new ones

  65. Update your build tool

  66. Update your build tool Updated Maven and Gradle required

  67. Compile against updated JDK

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

    features
  69. https://bit.ly/8-to-11

  70. In Summary

  71. Modern Java Can Help You

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

  73. There are two upgrade options

  74. There are two upgrade options To Java 11 (LTS) or

    to Java 15 (upgrade every 6 months)
  75. Upgrade Now And Reduce Future Pain

  76. Upgrade Now And Reduce Future Pain …and keep upgrading, at

    least in CI
  77. https://bit.ly/love-beyond-8 @trisha_gee