Beyond Java 8

3d6ace9554821d552146413bcdf874f6?s=47 Trisha Gee
March 04, 2019

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 12 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 presentation, we look at:

- Why upgrade from Java 8, including language features from Java 9, 10, 11 and 12
- 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

March 04, 2019
Tweet

Transcript

  1. None
  2. Upgrading Past Java 9 Sounds Scary …and I don’t want

    to pay for Java
  3. Super happy with Java 8, thanks

  4. None
  5. None
  6. None
  7. None
  8. None
  9. None
  10. None
  11. None
  12. Starting with Java 11, Oracle will provide JDK releases under

    the open source GNU General Public License v2, with the Classpath Exception (GPLv2+CPE), and under a commercial license for those using the Oracle JDK as part of an Oracle product or service, or who do not wish to use open source software. This… replaces the historical “BCL” license, which had a combination of free and paid commercial terms. Donald Smith, Sr. Director of Product Management (June 2018) https://blogs.oracle.com/java-platform-group/oracle-jdk-releases- for-java-11-and-later
  13. That sounds frightening, and overly complicated. Talk us through it.

    The Lego Batman Movie
  14. That sounds frightening, and overly complicated. Talk us through it.

    The Lego Batman Movie
  15. https://flic.kr/p/8xhk74

  16. From Java 11 forward, Oracle JDK builds and OpenJDK builds

    will be essentially identical. Donald Smith, Sr. Director of Product Management (Sept 2018) https://blogs.oracle.com/java-platform-group/oracle-jdk-releases- for-java-11-and-later
  17. https://blog.joda.org/2018/09/time-to-look-beyond-oracles-jdk.html

  18. None
  19. None
  20. https://adoptopenjdk.net

  21. https://adoptopenjdk.net/support.html

  22. None
  23. Language features

  24. JShell

  25. JShell

  26. JShell

  27. var

  28. var

  29. var

  30. var

  31. var

  32. var

  33. Convenience Factory Methods for Collections

  34. Convenience Factory Methods for Collections

  35. Convenience Factory Methods for Collections

  36. Convenience Factory Methods for Collections

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

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

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

  40. New Methods on Optional

  41. Http Client @tddmonkey

  42. Multi Release Jar Files

  43. Jigsaw

  44. Java Module System

  45. Java Module System

  46. JLink

  47. And in the future?

  48. Java 12: Switch expressions

  49. • JEP 302: Lambda Leftovers (including underscore for param) •

    JEP 305: Pattern Matching (Preview) • Data Classes for Java • Project Amber • Valhalla • Loom And in the future?
  50. None
  51. Performance

  52. Memory Usage

  53. • 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 Collectors
  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) • Java 12: JEP 189: Shenandoah (Experimental) • Java 12: More Updates to G1 • Java 12: More Improvements to ZGC Garbage Collectors
  55. Cost £$€

  56. Catch the 6 month release train

  57. If It Hurts, Do It More Frequently, and Bring the

    Pain Forward An idea from Extreme Programming (XP) Continuous Delivery – Jez Humble & Dave Farley
  58. None
  59. Modularity?

  60. Missing classes / methods

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

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

  64. Update your dependencies And add new ones

  65. Update your build tool Maven and Gradle work with Java

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

    features
  67. None
  68. Java Is Changing …fast

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

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

    least in CI
  71. None