Well, 2022 has begun. While most people are still on New Year's holidays with champagne and Olivier, we will talk about trends in the world of Java. Perhaps this will help you analyze your career, learn a new technology, or come up with a development plan for the coming year. Java trends in 2022: JDK 18 and 19, Project Loom and Data mesh - 1Java language specialist and lecturer Andrey Rodionov, as well as solution architect at EPAM and head of the Devoxx Ukraine program committee Oleg Tsal-Tsalko spoke about what awaits Java in 2022 and the near future.

What are the prospects for Java in 2022?

Java trends in 2022: JDK 18 and 19, Project Loom and Data mesh - 2This year we expect the release of the next two versions: JDK 18 (in March) and JDK 19 (in September). Potentially interesting for most Java developers in JDK 18 may be:
  • Built-in Simple Web Server, without support for a servlet container, which can be used for rapid prototyping and testing, similar to similar mini web servers in Python, Ruby, PHP.
  • Pattern matching continues to improve.
As for JDK 19, there is already an Early-Access Build, but there is no official list yet of what is planned to be included in it. I would like to believe that JDK 19 will at least include the first stable prototype of Project Loom, for which draft specifications have recently appeared and whose latest build is based on JDK 19. We will talk about Project Loom in more detail below.

For what areas does Java remain the only solution, and where is it preferable?

Andrey Rodionov:

Fortunately, we cannot say that there is no alternative to Java for any of the areas, but we can talk about Java as a kind of golden mean for developing enterprise applications, backends and microservices. It is also worth noting the increasing number of different JDK distributions from different vendors (except Oracle): Amazon, Microsoft, Alibaba, Red Hat, Bellsoft (founded by people from the Oracle Development Center in St. Petersburg) and others. The full set of distributions is available here . Java trends in 2022: JDK 18 and 19, Project Loom and Data mesh - 3There are always alternatives, but Java finds its greatest use on the backend in enterprise development. Most large companies choose Java for their large and complex systems. The reasons are the same: the number of developers and expertise on the market, a huge ecosystem and a powerful JVM platform.

What are the prospects for other jvm languages, in particular Kotlin, compared to Java?

Andrey Rodionov:

To understand which JVM languages ​​are popular, just open the documentation for Spring, Micronaut, Vert.x and see in which languages ​​the code examples are given - Java and Kotlin will be common. It cannot be said that there is a massive transition of projects to Kotlin, but its popularity for the backend continues to grow and many frameworks are trying to include it in their ecosystem. As for Scala, new versions are being released, and it is further actively used for ML, data processing, and where the functional programming paradigm is more convenient.

Oleg Tsal-Tsalko:

Other JVM languages ​​are quite attractive and nowadays it is quite normal for a project to use several programming languages. It seems to me that the reasons why newfangled JVM languages ​​cannot displace Java are as follows:
  • They are not so cool that everyone will just take them and switch to them.
  • They are used in the same segment as Java.
  • Java little by little takes the best from other languages ​​and becomes better.

Will there be a drop in Java quality due to shorter release intervals?

Oleg Tsal-Tsalko:

I think no. At least now I can identify more positive things from frequent releases. We see that new cool features appear much more often. Now you don’t have to wait 5 years for something new to appear in the language. Of course, now you shouldn’t expect such grandiose releases as Java 8, because features now appear in small iterations.

Are there features in new versions of Java that are especially important for developers?

Oleg Tsal-Tsalko:

Recent versions of Java have introduced several interesting features such as Pattern Matching, Sealed Classes and Records. I would recommend looking at their capabilities. Of course, the most serious and anticipated features are planned within Project Loom and Project Valhalla, but I think that features within these projects will also be released gradually.

Spring framework: will it continue to expand its ecosystem to suit diverse needs?

Andrey Rodionov:

As for the Spring Framework, its development has focused on supporting various features of Spring Cloud and the ability to compile Spring Boot into native binaries - the Spring Native project, which is planned to be part of Spring Core in the future. In this regard, Spring lagged behind Micronaut and Quarkus due to the active use of reflection and dynamic code generation. Regarding Spring Framework 6, I advise you to watch the report Spring 6 and Beyond What's new in Spring Framework 6? from the Joker conference (from Oleg Dokuka and Alexey Nesterov). The key ones are the transition to JDK 17, abandonment of XML Configuration and Autowire through setters, further development of Kotlin support and the Spring Fu project.

Oleg Tsal-Tsalko:

Spring, as the most popular Java FW nowadays, does not want to give up the palm. I'm sure the development team will put their best efforts into Spring development. Spring fills more and more niches. For example, Spring has done a lot in the Reactive Streams/Reactive Programming area with its Project Reactor. Now they are promoting the RSoket protocol, which also looks promising.

Tell us about the Loom project: what is it for, what problems does it solve?

Andrey Rodionov:

Project Loom is probably the most interesting innovation, which could become a new tectonic shift for the entire JVM platform and all languages ​​on top of the JVM. Project Loom may not affect ordinary developers as much, but it will definitely affect the entire ecosystem, libraries, frameworks, and other JVM languages ​​that use multithreading. Project Loom introduces a new thread abstraction - virtual threads (analogous to coroutines). If previously a Java thread was directly tied to an operating system (OS) thread, and the creation of a new thread in Java led to the creation of a new OS thread, then with virtual threads this one-to-one relationship is broken. When creating a new virtual thread, a new OS thread will not be created, and one of the so-called carrier threads (some kind of analogue of an OS thread pool) will be reused to perform direct calculations. Thus, several virtual threads can run on top of one OS thread. For computing tasks, this model of virtual threads does not provide any advantages, and rather slows down the speed of calculations, but for blocking operations, such as processing HTTP requests, waiting for responses from the database or from microservices, this model will be a significant advantage. The fact is that with the current threading model, blocking/waiting on a Java thread led to idle OS threads - this was a waste of resources and required creating more OS threads. In the virtual thread model, blocking/waiting on a virtual thread will cause the carrier thread on top of which the virtual thread was running to be released and another virtual thread to run on it. This way, OS threads will be used more optimally and fewer of them will be needed to perform similar tasks. Accordingly, manufacturers of libraries, frameworks and JVM languages ​​will have to adapt their code for virtual threads. Therefore, a big rewrite is coming for them :) In addition to the virtual thread model, it is also planned to introduce a new API to simplify thread orchestration - the so-called structured concurrency. Now, for example, structured concurrency is actively used in Kotlin coroutines and Scala ZIO. Unfortunately, the JDK version and even the release year of Project Loom are still unknown. When asked about the release date, the chief architect of the Java platform, Brian Goetz, answers with a philosophical phrase: “It will be ready, when it will be ready.” Therefore, we are waiting and can try experimental builds of Project Loom .

Oleg Tsal-Tsalko:

Loom is a large umbrella project, within which the OpenJDK and Oracle team is working on Concurrency innovations in Java and JVM: virtual threads, fibers and continuations. Most likely, the release of these features will be gradual. At the moment there are only Early Access builds for Virtual threads support. Specifically speaking about virtual threads, its main goal is to simplify the multi-threaded development model in Java by using millions of lightweight threads with the same semantics as regular platform threads. Under the hood, these threads will be managed inside the ForkJoinPool and reused by platform threads.

What are the forecasts for the development of Java in the world of global trends - microservices, cloud architecture, blockchain, AI?

Andrey Rodionov:

If we talk about global trends, they have not changed much. As before, the main trend continues to be Kubernetes and the infrastructure around it in the form of Service mesh . Data mesh is also gaining popularity as a kind of abstraction for managing distributed data sources and storages.