BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News IntelliJ IDEA 2021.1 EAP 1 Supports Java 16

IntelliJ IDEA 2021.1 EAP 1 Supports Java 16

This item in japanese

Lire ce contenu en français

Bookmarks

JetBrains released IntelliJ IDEA 2021.1 EAP 1 featuring full support for Java 16. Other noteworthy features include support for Windows Subsystem for Linux (WSL) 2, a built-in browser to preview HTML files and improved profiling support. This release also makes it possible to run applications via Docker, SSL, and WSL.

IntelliJ IDEA 2021.1 EAP 1 is the first Early Access Program (EAP) release for the upcoming 2021.1 The GA release is scheduled for March 2021. EAPs are used for the Java community to test new IntelliJ IDEA features and provide feedback, so those features can be further improved before an official GA release.

This EAP supports Java 16, also scheduled for a March 2021 release. One of the new features of Java 16 is the ability to include static members in inner classes. This feature is supported in this EAP release:


public class OuterClass {
    class InnerClass {
        static final String STATIC_MESSAGE = new String("Works in Java 16");

        static String staticMethod() {
            return STATIC_MESSAGE;
        }
    }
}

The language level may be set to 16 - Records, patterns, local enums and interfaces or to 16(Preview) - Sealed types under File | Project Structure | Modules.

Before Java 16, the common way to retrieve a list from a stream was to write stream.collect(Collectors.toList()). Java 16 allows a more concise way to retrieve the list from a stream by writing stream.toList().

IntelliJ IDEA supports the new Java 16 toList() method and displays it first on the code completion for an instance of the Stream interface.

IntelliJ toList()

It's possible to replace the old way of retrieving a list from a stream with the new way. However, please note that a call to stream.toList() returns an immutable list, where a call to stream.collect(Collectors.toList()) may possibly return a mutable list. If existing code expects a mutable list, then using stream.toList() cannot be used as a drop-in replacement.

This release provides initial support for WSL 2. IntelliJ IDEA can now detect JDKs installed in WSL 2 and, if necessary, download and install a JDK. Once installed, the code can be compiled and run by the IntelliJ IDEA build system. Future EAP builds will include support for Maven and Gradle in WSL 2.

This release contains a new built-in browser to preview HTML files. The preview browser can be accessed by clicking on the IntelliJ IDEA logo in the widget in the top right of the editor. After activating the preview mode, changes to any HTML, CSS and JavaScript code are shown immediately in the built-in browser.

Run Targets is another new feature that provides the ability to run, test, and debug an application on a target. Supported targets to run an application include Docker, SSH, and WSL. With Run Targets, it's possible to run Java applications, JUnit tests and Maven on one of the supported targets.

The profiler displays running applications including their PID and CPU usage. By clicking on an application’s name, it's possible to attach one of the profilers: CPU Profiler, Allocation Profiler or Java Flight Recorder. With a right-click, it's possible to run two new actions. Capture Memory Snapshot creates *.hprof snapshots of the running application to locate performance challenges. CPU and Memory Live Charts visualize live the CPU and memory consumption of the application.

This release brings back the option to change settings during the import of a Maven project. The feature is activated through File | New Projects Settings | Preferences for new Projects | Build, Execution, Deployment | Build Tools | Maven and then selecting "Show settings dialog for new Maven projects".

Filtering the external dependencies in the search scope is now possible, for instance, when searching for a string in the project. To enable it, navigate to Edit | Find | Find in Files | Scope and then click on "...". A Scopes dialog box is displayed to include or exclude external dependencies.

JetBrains Space, an integrated team solution, offers Git repositories among other features. The Space plugin is now included out-of-the-box and allows easier integration between IntelliJ IDEA and JetBrains Space. With the plugin, it's possible to login, work with Git repositories, and review code without leaving the IDE. It's also possible to use a code inspection profile before committing new code to the repository.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT