Skip to main content

Java 25 LTS is now available with features like module import declarations, compact source files

Java 25 was released today as the latest Long Term Support (LTS) version of the language, meaning it will be supported by Oracle for at least eight more years.

Oracle releases a new LTS version of Java every two years, and the previous LTS release was Java 21, back in 2023. “If you look back from 21 to 25, and all the things that have come in 22, 23, and 24, then I believe 25 definitely could be one of the first versions where people are looking at it and going ‘I can’t not get to 25, I can’t stay back,’” said Chad Arimura, VP of Java Developer Relations at Oracle.

New language features

This release introduces several stable language features, including module import declarations, compact source files and instance main methods, and flexible constructor bodies.

Module import declarations allow developers to import all of the packages exported by a module, without that module needing to contain importing code. This functionality will make it easier for developers to reuse libraries, and also helps newer Java developers use third-party libraries and Java classes without needing to learn where they exist in a package hierarchy.

Compact source files and instance main methods allow students to write smaller programs without first needing to learn about language features designed for large codebases. “This has been previewed three or four times, and it’s going as a final feature now,” said Arimura. “It’s all about making the language more concise for new learners and students and people who want to write scripts in Java.”

Flexible constructor bodies allow input validations and safe computations to be done without invoking a constructor. According to Oracle, this change will enable constructors to be expressed more naturally, and also allows fields to be initialized before becoming visible to other code in the class.

This release also includes the third preview of primitive types in Patterns, instanceof, and switch, which aims to make Java more uniform and expressive. No changes have been made since the second preview in JDK 24. “There was kind of this gap where you couldn’t use primitives and switch expressions to switch across, and now you can and it’s much cleaner,” said Arimura. “You can do some pretty cool stuff, like safe type casting and checking to see whether you can take primitives and cast them into other types of primitives without any lossiness to the value.”

Library features

Scoped values is now stable, allowing immutable data to be shared within and across threads. This improves ease-of-use, comprehensibility, performance, and robustness, particularly for applications that are using AI platforms, web frames, and microservices.

Structured concurrency is now in its fifth preview, and it treats groups of related tasks in different threads as a single unit of work, which helps reduce risks that come out of cancellation and shutdown.

There is also a preview of an API for stable values, or objects that hold immutable data. Stable values are treated as constants by the JVM, so they allow for the same performance optimizations as declaring a field final and offer more flexibility over when they are initialized.

Finally, this release will see the tenth incubator of the vector API, which expresses vector computations that compile at runtime as optimal vector instructions on supported CPU architectures.

Miscellaneous updates

Java 25 also features several updates across security libraries, performance, and monitoring.

For security, there is a new API for key derivation functions and a preview of a new API for encoding objects.

Performance updates include compact object headers, ahead-of-time command-line ergonomics, and ahead-of-time method profiling. “You can profile your application, create a cache, fire up your application, and not have to preload and do all the JIT and everything. It actually preloads bytecode right in and that makes it faster to get your application up and running,” Arimura explained.

Several improvements were also made to the JDK Flight Recorder (JFR), such as more accurate CPU-time profiling information, cooperative sampling of thread stacks, and functions for method timing and tracing.

The post Java 25 LTS is now available with features like module import declarations, compact source files appeared first on SD Times.



from SD Times https://ift.tt/dMVtgl8

Comments

Popular posts from this blog

A guide to data integration tools

CData Software is a leader in data access and connectivity solutions. It specializes in the development of data drivers and data access technologies for real-time access to online or on-premise applications, databases and web APIs. The company is focused on bringing data connectivity capabilities natively into tools organizations already use. It also features ETL/ELT solutions, enterprise connectors, and data visualization. Matillion ’s data transformation software empowers customers to extract data from a wide number of sources, load it into their chosen cloud data warehouse (CDW) and transform that data from its siloed source state, into analytics-ready insights – prepared for advanced analytics, machine learning, and artificial intelligence use cases. Only Matillion is purpose-built for Snowflake, Amazon Redshift, Google BigQuery, and Microsoft Azure, enabling businesses to achieve new levels of simplicity, speed, scale, and savings. Trusted by companies of all sizes to meet...

2022: The year of hybrid work

Remote work was once considered a luxury to many, but in 2020, it became a necessity for a large portion of the workforce, as the scary and unknown COVID-19 virus sickened and even took the lives of so many people around the world.  Some workers were able to thrive in a remote setting, while others felt isolated and struggled to keep up a balance between their work and home lives. Last year saw the availability of life-saving vaccines, so companies were able to start having the conversation about what to do next. Should they keep everyone remote? Should they go back to working in the office full time? Or should they do something in between? Enter hybrid work, which offers a mix of the two. A Fall 2021 study conducted by Google revealed that over 75% of survey respondents expect hybrid work to become a standard practice within their organization within the next three years.  Thus, two years after the world abruptly shifted to widespread adoption of remote work, we are dec...

Olive and NTT DATA Join Forces to Accelerate the Global Development and Deployment of AI Solutions

U.S.A., March 14, 2021 — Olive , the automation company creating the Internet of Healthcare, today announced an alliance with NTT DATA , a global digital business and IT services leader. The collaboration will fast track the creation of new healthcare solutions to transform the health experience for humans — both in the traditional healthcare setting and at home. As a member of Olive’s Deploy, Develop and Distribute Partnership Programs , NTT DATA is leveraging Olive’s open platform to innovate, build and distribute solutions to Olive’s customers, which include some of the country’s largest health providers. Olive and NTT DATA will co-develop new Loops — applications that work on Olive’s platform to provide humans real-time intelligence — and new machine learning and robotic process automation (RPA) models. NTT DATA and Olive will devote an early focus to enabling efficiencies in supply chain and IT, with other disciplines to follow. “This is an exciting period of growth at Olive, so...