JAVA 21 is here, but….

Sebastian Torralba
AvengaLATAM
Published in
5 min readAug 5, 2023

I was amazed with the amount of posts about Java 21, its new ( and severals) features, its previews, etc. some of them are very interesting and necessary, but others I saw as an unnecessary way of be more closer to other languages that have taken away a bit of the market share, for example Unnamed Classes and Instance Main Methods (Preview) (https://openjdk.org/jeps/445). The List of features is:

  • Vector API (Sixth Incubator)
  • String Templates (Preview)
  • Unnamed Patterns and Variables (Preview)
  • Unnamed Classes and Instance Main Methods (Preview)
  • Scoped Values (Preview)
  • Foreign Function & Memory API (Third Preview)
  • Structured Concurrency (Preview)

I will not make a mention about these new features (so far).
But what take my attention? is of the available LTS versions Java 8 or 11 are still the industry standard, over 17 LTS. This brought me back memories of when I was a Developer on Powerbuilder, which despite already being around version 12.5, the most used were 6.5 (First version of Sybase without touch anything) or 10.5 (The more decent version from Sybase before with hands-on). So the question is: What makes us stay with a certain version, what are the reasons that encourage us to migrate to a new one? Let’s review the main features of each version and see if there are the necessary reasons to migrate

The List

Java8:

  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:

  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:

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

Java 11:

  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:

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

Java 13:

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

Java 14:

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

Java 15:

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

Java 16:

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

Java 17:

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

Java 18

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

Java 19

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

Java 20

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

A long time ago I readed Freakonomics by Steven D. Levitt and Stephen J. Dubner, it really blew my mind to understand how motivation works on us. According to his approach, motivation can be understood as a quest to maximize rewards and minimize costs. People make decisions based on a subjective evaluation of the expected benefits and consequences. Understanding this, let’s explore the motivations for be stuck it with certain versions of Java.

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 the module system 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 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. Sealed classes: allow you to control which classes can be subclasses of a given class. This provides greater security and control over class inheritance. Java Records: (I’ve been waiting years for this one) 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 there is lombok that is already rooted in the community, this encourages the absence of Java Records in the other LTS to be solved, using this library, although being purists it is not the same, but it is similar.

Conclusion:

Personally, I am a happy user of Java 17 LTS, I go almost directly from 8, with a little scale in 11. Because like I mentioned about Powerbuilder, I have already experienced a transition of companies (powersoft to sybase and to sap) and the ups and downs between versions until a full reliability is achieved, dont because of the product itself, but because of this owners transition and those responsible for the technology, also the features up to 11, for what I had been doing, dont change the panorama, no do they represent an improvement in my productivity, today with 17 already with all the features established from previous versions.

--

--

Sebastian Torralba
AvengaLATAM

Software Architect / Java Team Leader at IncluIT Professor at UNLaR