Just a few days ago, the new version of Java software development artifact IDEA 2020.1 was released:
I updated and experienced it for a few days on the machine for the first time, and it still feels a bit fragrant! What's the matter? After experiencing the new features, I can't help but sigh: IDEA is really getting smarter and more understanding of developers now.
UI / interface upgrade
1. The interface supports Chinese
The effect after being finished in Chinese is this simple look:
Every flower comes into its own eyes, no good or bad judgement, you can adjust it according to your preferences.
It must be said that this Chinese localization is not natively supported by the software, but needs to download and install a Chinese (Simplified) Language Pack
plugin called , fortunately this plugin is JetBrains
officially provided
2. The evolution of the navigation bar
Now the code level navigation bar can directly locate a specific method or field in the file, this is indeed very efficient
3. Support Javadocs
rendering in the editor
It used to be Javadoc
very inconvenient to read in IDEA , because the original state Javadoc
contains various marks, which is not easy to read. This new version of IDEA 2020 has a new Javadocs
rendering function that can be enabled by clicking the small button on the left
After rendering, Javadoc
it is very intuitive and easy to read, and you can also adjust the font size
4. New themes and fonts
First of all, it supports its JetBrains
own new JetBrains Mono
font by default . This is nothing to say. I have experienced it before. For details, please refer to the previous article "Test Water JetBrains Official New Programming Font, Really Fragrant!" 》
Then the unified IntelliJ Light
theme is adopted , and the theme has been completely unified in different operating systems
Do you like to see everyone's personal habits?
5. The ship's new LightEdit mode
LightEdit
, As the name suggests, lightweight code editing.
Yes, this updated IDEA supports opening a single code file for editing without opening the entire project. The file can be opened in a separate editing window, and this window can coexist with other (project) windows. like this:
More powerful is that it directly supports the quick opening of the complete project where this single file is located:
You can even open a single file through the command line, which is quite ok:
6. Support "Zen" mode
The current code display mode is rich enough to support four types:
Of course, the Zen mode is the most thorough. As soon as you open this mode, the whole world is clean ...
7. The terminal supports columns
Now you can arbitrarily divide the terminal that comes with IDEA into columns, which is very convenient
Support direct installation of JDK and Git in IDEA
Many small partners communicated that their JDK environment seems to have problems, and there are problems in various experiments. For this matter, obsessive-compulsive disorder is almost committed, very annoying.
Starting from IntelliJ IDEA 2020.1, we can directly download and set up the JDK environment from IDEA when creating a project, which is very convenient.
I specially experimented, and downloaded and installed an Open JDK 14 in IDEA. No problem, easy to use, and switching is also very convenient.
In addition, IDEA also directly supports the installation of Git.
Support Java 14 new features
Some time ago, Java 14 was released, and some new features were added. This time IDEA 2020.1 quickly followed up and supported some of the new features of Java 14. Here are two typical examples.
1. instanceof
Usage enhancement
In the old Java version, we generally use instanceof syntax like this:
private void test( Object obj ) {
if( obj instanceof String ) {
String str = (String) obj; // 需手动强制转换!
System.out.println( str.isEmpty() );
}
}
And Java 14 has instanceof
enhanced the usage. With the help of a new one IDEA 2020
, we can quickly restructure the above code as follows:
So eventually it became this sub-child:
private void test( Object obj ) {
if( obj instanceof String str ) { // 校验通过,直接后面定义变量,无需强转!
System.out.println( str.isEmpty() );
}
}
2. record
New grammar support
Java 14 added a record
new syntax, record
the lexical meaning "record" , mainly used for fixed record formalized, it is mainly through before the immutable class to achieve, give you an example.
For example, we define an immutable log record class LogRecord
, which contains log ID ( id
), log time ( date
), log details ( detail
), according to the old practice, can only be used class
to define:
public final class LogRecord { // 不可变类
private final int id;
private final LocalDate date;
private final String detail;
public LogRecord(int id, LocalDate date, String detail) {
this.id = id;
this.date = date;
this.detail = detail;
}
public int getId() {
return id;
}
public LocalDate getDate() {
return date;
}
public String getDetail() {
return detail;
}
@Override
public String toString() {
return "LogRecord{" +
"id=" + id +
", date=" + date +
", detail='" + detail + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LogRecord logRecord = (LogRecord) o;
return id == logRecord.id &&
Objects.equals(date, logRecord.date) &&
Objects.equals(detail, logRecord.detail);
}
@Override
public int hashCode() {
return Objects.hash(id, date, detail);
}
}
Java 14 think above this final
type class
defined routines are completely fixed, fixed routines written a lot of code, including: constructor, Getter
method, toString()
methods, hashCode()
and equals()
methods, etc., very boring.
To this end, Java 14 introduced a new record
syntax, which can be done with just one line of code, which is very convenient:
record LogRecord( int id, LocalDate date, String detail ) {
}
This time, IDEA 2020 already fully supports recod
grammar, and can also automatically record
generate various methods for explicit :
Support more intelligent inspection and reconstruction
1. Support local method change signature
What does that mean? for example.
When you want to directly modify the parameters of an existing method, no matter 3, 21, 21, you can directly modify the method signature, and then click Update, all the next steps IDEA can help you complete.
2. Intelligent analysis of date string format
For example, in this example, when I formatted a date, I accidentally yyyy/MM/dd
wrote the year, month, and day strings yyyy/mm/dd
, and MM
forgot the upper and lower case, IDEA automatically analyzed it for us:
3. Smart grammar and spell checker
This feature must Grazie
be used in conjunction with this plugin, which is a comprehensive grammar, spelling, and style checking tool.
For example, I shook my hand at this place and wrote the wrong English grammar, and it prompted us immediately
Enhanced debugging
1. The data flow analysis assistant can directly predict the following operation results
IDEA 2020.1 directly adds data flow analysis to the JVM debugger. When the program stops at the breakpoint, IDEA can run data flow analysis based on the current state of the program to predict what will happen next.
2. Supports fixed object fields when debugging
When an object has too many fields, so that it is difficult to find the required field during debugging, we can directly put it on the top for easy viewing.
3. Store the running configuration in the form of a file
The new version of IDEA supports directly archiving the current debugging / running configuration and choosing to reload it later
More advanced version control
The first big improvement is to redesign the code submission window, instead of the old modal pop-up window. In this way, when the code is submitted for comparison, the editor will be more comfortable.
The second improvement is to support searching , refreshing local and remote code branches:
In addition, leaving traces in this historical log is pretty good:
Maven and Gradle import updates
Take the Maven tool as an example here, a floating notification appears in the upper right corner of the editor. After modifying the build file, you can use this mini notification icon to load the changes.
Database processing enhancements
The new version of IDEA's built-in database management can now support exporting data to a Excel(.xlsx)
file, and directly view it as text in the editor
Enhanced HTTP Client
After the upgrade, it is HTTP Client
more intelligent, typical examples are: support for automatic matching and completion
And you can also Contoller
automatically generate HTTP request files on the left side of the code in a quick way
And for the Spring project, you can also Endpoints
quickly generate HTTP request files in the bottom window.
Other improvements
1. Support and improvement of various frameworks, such as: Spring WebFlux/Selenium/JMS/Micronaut/RxJava
etc.
2. Docker/Kubernetes
Support improvements
3. Scala 3
Support
4. Android Volley
Support
5. JavaScript
Improvement and support
summary
After some experience, I found that the new version of IDEA 2020.1 has many visual improvements, which are quite fragrant.
However, there is another practical problem: after I upgraded, I found that a large number of plugins were not available, so the compatibility of peripheral support had to wait.