Java 20 is basically a patch release on Java 19. But it's important + necessary. Three highlights:
Pattern matching bug fixes. If you tried to use Java 19 pattern matching with generics there were large bugs that were fixed in Java 20. Now, Java 20 has excellent pattern matching. This is an epic feature that enables completely new frameworks and programming styles as demonstrated in Brian Goetz's article (https://www.infoq.com/articles/data-oriented-programming-java/). This enables programs to parse JSON and data structures with much more elegance and expressiveness. While Java Optional doesn't use records + pattern matching, this enables people to use a third party or custom version that does. This also let's people do something like Scala/Haskell Either or Rust Result that holds a result or an error value.
Scoped Values. This completes Project Loom's major features and this is necessary for some frameworks.
Java needed another preview release for virtual threads and pattern matching. Those are expected to go final in Java 21, which will be epic, but those needed another round of public previews and time to collect public feedback.
> Scoped Values. This completes Project Loom's major features and this is necessary for some frameworks.
Project loom is an ongoing project with the intent to "explore, incubate and deliver Java VM features and APIs built on top of them for the purpose of supporting easy-to-use, high-throughput lightweight concurrency and new programming models on the Java platform. "
Virtual threads, structured concurrency, scoped values are deliverables. There are other things in the pipeline such as continuations and tail calls that we might see in the future.
35
u/Joram2 Mar 21 '23
Java 20 is basically a patch release on Java 19. But it's important + necessary. Three highlights:
Pattern matching bug fixes. If you tried to use Java 19 pattern matching with generics there were large bugs that were fixed in Java 20. Now, Java 20 has excellent pattern matching. This is an epic feature that enables completely new frameworks and programming styles as demonstrated in Brian Goetz's article (https://www.infoq.com/articles/data-oriented-programming-java/). This enables programs to parse JSON and data structures with much more elegance and expressiveness. While Java Optional doesn't use records + pattern matching, this enables people to use a third party or custom version that does. This also let's people do something like Scala/Haskell Either or Rust Result that holds a result or an error value.
Scoped Values. This completes Project Loom's major features and this is necessary for some frameworks.
Java needed another preview release for virtual threads and pattern matching. Those are expected to go final in Java 21, which will be epic, but those needed another round of public previews and time to collect public feedback.