JetBrains releases IntelliJ IDEA 2021.1

JetBrains has released IntelliJ IDEA 2021.1, which features support for Java 16, a new preview feature for instant rendering of HTML changes, and support for Windows Subsystem for Linux(WSL)2. You can also run applications on Docker, WSL 2, or over SSH. Various other improvements include support for Docker, Kubernetes, Kotlin, Git, and others.

A new Java 16 feature supported by IntelliJ is the ability to declare static members in an internal class.

Public class OuterClass {class InnerClass {static final String STATIC_MESSAGE = new String("Works in Java 16"). Static string staticMethod() {return STATIC_MESSAGE. }}Copy the code

Traditional Java Bean class files can be converted to Java Records. This can be done automatically when all fields are declared **final. For example, the Student** class shown below can be converted to a record by pressing Alt-Enter on the class name and selecting Convert to a Record.

public class Student { private final String firstName; public Student(String firstName) { this.firstName = firstName; } public String firstName() {return firstName. }}Copy the code
public record Student(String firstName) {
}
Copy the code

Records have no explicit getter methods, such as the firstName() method shown in the Student class. However, if a class contains a getter method, such as getFirstName(), then the generated record will also have the **getFirstName()** method.

You can also search for all eligible classes that might be converted to records. In cases where records do not provide the required functionality, record-to-class transformations can be used.

Pattern matching for the Instanceof operator has always been a two-step process. First, instanceof is used to check that its arguments are of the correct type, and second, the object is cast to that particular type. Java 16’s pattern matching eliminates the need for casting, and IntelliJ can replace the old pattern matching style and remove casting.

IntelliJ IDEA supports the new Java 16 toList() method and shows it first in code completion of the Stream interface instance.

A warning is now displayed whenever the size of an array or condition is negative. When the collection.toarray () method is used incorrectly, another warning is displayed to avoid a possible ClassCastException.

The new HTML preview feature can be turned on by clicking on the IntelliJ icon, as shown below. Changes to HTML, CSS, and JavaScript are immediately displayed in the preview window.

Run Targets is an ultimate feature of IntelliJ IDEA that provides the ability to Run, test, and debug applications on Targets. With Run Targets, you can Run Java applications, JUnit tests, Maven, Gradle, Micronaut, Spring Boot and Quarkus (Maven-based) projects on Docker, SSH and WSL.

IntelliJ IDEA can now detect the JDK installed in WSL 2, and download and install the JDK if necessary. Once installed, Java projects in WSL 2 can be compiled and run by the IntelliJ IDEA build system. The Maven or Gradle application \ WSL $in WSL 2 can be used in IntelliJ.

You can create custom Git commit templates for custom information. Running checks makes it possible to analyze code before committing. You can copy a file from one branch to another by comparing the options with the branches, selecting the file, and clicking the down arrow.

Now supports the use of Goessner or Jayway JSONPath Expression syntax, can Edit | Find | the Evaluate JSONPath Expression for testing. Selecting a JSONPath expression and pressing Alt+Enter can be used to evaluate a JSONPath expression. The new version also supports delimited JSON files such as.jsonl,.jslines,.ldjson, and.ndjson.

Docker availability has been improved by introducing code completion in IntelliJ’s configuration window and in image names in Docker files. The container can be started from a Docker file and can now be stopped by clicking Stop Deploy.

In a multi-stage Docker file, a hammer icon is displayed for each stage and only that stage is built. When you add the Run section to the Run/Debug configuration, the icon changes and it builds an image and runs a container.

Kubernetes resources can be deleted by opening the configuration file and clicking the Run icon. Kustomize, Google’s template-free YAML tool for Kubernetes, introduced components in version 3.7.0, They can through the Settings/Preference | Languages and Frameworks | Kubernetes kustomize version of the configuration required for use in IntelliJ.

Kotlin’s code analysis speed and code completion have been improved. A warning about improperly blocking method calls was introduced and a problem with Kotlin’s language injection functionality was fixed.

The USER experience and user interface of the HTTP client have been updated to optionally copy the body of the response rather than the rest of the response. SSL support for client authentication can now be implemented by clicking Add Environment File and then clicking Private.

Other new features include:

  • Chained method callsThe formatting rules can be passedSet the Java | | | | code editor style packaging and braces | chain method callConfigure.
  • A new save to Shelf action: Saves the user’s changes on the shelf and also saves them in local changes.
  • On Windows, recent projects can be opened by right-clicking on the IntelliJ IDEA icon.

More details of the new features can be found in the What’s New section of the IntelliJ IDEA 2021.1 page.

IntelliJ IDEA was originally launched in January 2001 and is used by over 4 million developers worldwide. JetBrains recently celebrated its 20th anniversary with a look back at all the highlights of the past 20 years.

JetBrains Releases IntelliJ IDEA 2021.1

] (www.infoq.com/news/2021/0)…