java versions

Changes with each version of Java

Let’s review the main features of each version and see if there are the necessary reasons to migrate.

Java7:

  1. Java try with resources enhancements

Java8:

Details: java8

Overview:

  1. Lambda Expressions
  2. Streams API
  3. Default method in interface
  4. Reference functions
  5. New date and time API
  6. Variable type annotations
  7. Java security improvements

java 9:

Details: java9

Overview:

  1. Java Modules (Java Platform Module System) 2.
  2. Immutable Collections 3.
  3. Collection Factory 4.
  4. Improved parallel garbage collection process 5.
  5. Java performance improvements

Java 10:

Overview:

  1. Local variable type inference
  2. Performance improvement APIs
  3. Java security improvements
  4. Java performance improvements

Java 11:

Overview:

  1. Var for lambda parameters
  2. Standard HTTP Client API
  3. Support for Unicode 10.0
  4. Improved Garbage Collector (Epsilon)
  5. Java performance improvements

Java 12:

Overview:

  1. Expression Switch
  2. Improved parallel garbage collection process
  3. Improved JVM performance
  4. Java security improvements

Java 13:

Overview:

  1. Text Blocks
  2. Garbage Collector Update
  3. Changes in lambda expressions
  4. Java security improvements

Java 14:

Overview:

  1. Records
  2. Instanceof Patterns
  3. Java security improvements
  4. Garbage Collector Update

Java 15:

Overview:

  1. Match patterns
  2. Improved Text Blocks
  3. Improved Java security
  4. Garbage Collector Update

Java 16:

Overview:

  1. Improved records
  2. Improved matching patterns
  3. Java security improvements
  4. Garbage Collector Update

Java 17:

Overview:

  1. New file type in Java
  2. New cryptography security APIs
  3. New native memory system
  4. Java security improvements

Java 18

Overview:

  1. Default UTF8
  2. Simple Web Server
  3. Vector API
  4. SPI Internet Address Resolution

Java 19

Overview:

  1. Patterns for Record
  2. Virtual Threads (Loom Project)
  3. Linux/RISC-V Port

Java 20

Overview:

  1. Patterns for Record
  2. Virtual Threads (Loom Project)
  3. Vector API
  4. External Functions and Memory Api

java21

Overview:

  1. Vector API (Sixth Incubator)
  2. String Templates (Preview)
  3. Unnamed Patterns and Variables (Preview)
  4. Unnamed Classes and Instance Main Methods - https://openjdk.org/jeps/445
  5. Scoped Values (Preview)
  6. Foreign Function & Memory API (Third Preview)
  7. Structured Concurrency (Preview)

Motivations to be stuck with certain versions

Stability: Java 8 has been available for a long time, this has allowed companies and organizations to adapt their systems and applications to this version. This has led to widespread adoption, stability and reliability of Java 8.

Backwards Compatibility: Java is known for its focus on backwards compatibility, applications developed on earlier versions of Java often work without issue on Java 8. This has made the transition and the upgrade easier for many projects.

Frameworks and libraries: Java has a very large and mature ecosystem, with many libraries and frameworks available that are compatible with Java 8. Many of these libraries have not yet been fully migrated to newer versions of Java, which has contributed to continuity from using Java 8.

Really useful features: Java 8 and Java 11 introduce a series of changes that were really necessary at that time, not only to keep the language competitive against others, but also to improve performance and productivity. For example, lambda expressions and the Java 8 Streams API, which enable more concise and readable code, and facilitate functional programming and processing collections of data. In Java 11 LTS, the module system (introduced in Java 9) allows you to modularize applications and the JDK into smaller, well-defined components. This helps improve code encapsulation, reuse and maintainability. Plus, the standard HTTP Client API (introduced in Java 9) is more modern and flexible compared to the old HttpURLConnection. It provides advanced features such as asynchronous request handling, plugins, and native support for HTTP/2.

Now Java 17, is almost 2 years old on the market and still doesnt reach its predecessors on the market share, positioning itself as the market standard, with very good features, but they are still not enough motivation for change.

  1. Sealed classes: allow you to control which classes can be subclasses of a given class. This provides greater security and control over class inheritance.
  2. Java Records: (introduced with JDK 14) simplifies the creation of classes used to store data (such as data models or information structures). A Java Record is an immutable, data-only class that automatically provides the implementation of common methods, such as the equals(), hashCode(), and toString() methods, based on the fields declared in the class. But the lombok library is already rooted in the community; this compensates for the absence of Java Records in the previous LTS versions.

TODO

https://www.baeldung.com/java-enterprise-evolution

https://medium.com/javarevisited/safe-migration-from-lombok-to-records-using-only-intellij-tricks-150791ea00ab

https://medium.com/incluit/java-21-is-here-but-11ed3d1ea976


Links to this note