IntelliJ IDEA 2021.2 EAP 4: Project-Wide Analysis, New Java Inspections, and More
Week four of IntelliJ IDEA 2021.2 EAP starts now! As usual, it brings a new build with new features and helpful fixes. You can get it from our website, the free Toolbox App, or as a snap (for Ubuntu).
You can test out our new project-wide analysis – a feature that is highly anticipated by the developer community. There are also some nice new Java and Kotlin inspections and intention actions we have introduced in the EAP.
Before we begin, please note that starting with this EAP, you can join the program in IntelliJ IDEA Ultimate only if you have an active JetBrains account. If you have already logged in with your credentials, you can access the EAP builds automatically. If you have not yet logged in, the IDE will redirect you to account.jetbrains.com where you can enter your login and password or create a new JetBrains account.
Read the blog post for more information.
Meanwhile, let’s take a look at what’s new this week!
Project-wide analysis for Java projects
IntelliJ IDEA now has a helpful new feature to help you keep track of all the errors throughout your Java project. Project-wide analysis can be performed in the Problems tool window. Simply click the new icon in the top left-hand corner of the window. A benefit of this is that you can start using project-wide analysis before even compiling the project.
When you click the icon, IntelliJ IDEA will begin checking your project and then displays any issues that arise, including those that are usually only detected by scanning the whole project. Please note that the first check may take longer than subsequent ones.
IntelliJ IDEA shows a progress bar at the bottom, but you can expand it into a dialog by clicking on it.
If you need to stop the analysis, just click the icon that started the process again.
After the IDE has finished the checks, the results will appear in the Problems tool window.
The feature only works with small and medium-size projects. Feel free to test it out and share your thoughts!
We’ve found ways to improve the UX during the inspection review by adding relatively simple yet effective inspections and quick-fixes. In this EAP, we want to introduce them.
Floating-point range tracking
Data Flow Analysis allows you to track the ranges of float and double values. IntelliJ IDEA can now statistically verify the conditions with doubles and Float.isNan.
In addition to that, the inspection works when you cast int to double, or vice versa. These casts are now correctly converted.
Collection size tracking on update methods
Another helpful update to Data Flow Analysis is that it now tracks the collection size after the collection is updated via the following methods: add, addAll, put, putAll, remove, removeAll, and retainAll. If there are any errors detected, the inspection will highlight them.
Write-only object inspection
IntelliJ IDEA offers several inspections to warn you when you modify an object but never query it, for example, Mismatched query and update of collection or Mismatched read and write of array inspections.
Our new Write-only object inspection performs the same check for some custom classes defined in your project and the standard library. For example, it supports AtomicReference.
Quick-fix to solve similar compilation errors
We’ve added a new quick-fix that you can apply to all identical compilation errors in your file in one click. Try this quick-fix out and let us know if there is anywhere that it is not available.
Improved Overwritten Map, Set, or Array Element inspection
An inspection that deals with overwritten keys or elements now supports local variables.
If you overwrite because of a switch fall-through, IntelliJ IDEA detects it.
The same inspection now works for overwritten array elements and highlights duplicated array element assignments.
We’ve also expanded the unused assignment inspection to detect overwritten fields.
Inspection to simplify call chain on collection type
It is now possible to simplify the syntax and combine several calls into one when IntelliJ IDEA calls methods in a chain inside a collection.
Intention action for buildString conversion
If you use buildString to customize your code, you don’t need to type it manually anymore, because we’ve added an intention action that will do it for you.
Other inspections and intention actions
After analyzing how often you use several plugins, we’ve decided to unbundle some of them, including Drools, JSP Debugger Support, CoffeeScript, Spring Web Flow, Spring OSGI, Arquillian, AspectJ, Guice, Helidon, and EJB. If you still need any of these plugins, please install them manually from JetBrains Marketplace.
This week we’ve fixed some of the most upvoted issues. Have a look:
- Fixed the error that appears when you click Download sources for Maven projects. [IDEA-247792]
- Supported .mvn/jvm.config to define JVM configurations for Maven builds. [IDEA-205178]
- Fixed the Esc key behavior in some dialogs. [IDEA-270541]
- Tool windows open via a mouse click on Linux. [IDEA-270699]
- It is again possible to create a new branch via a dialog invoked from the VCS operations popup. [IDEA-270325]
- Fixed incorrect encoding in .properties files. [IDEA-266551]
- The IDE automatically deletes empty scratch files. [IDEA-194931]
- Fixed the problem causing the IDE to freeze in the Plugin migration dialog after deleting configs and restarting. [IDEA-270855]
- Fixed the NullPointerException when creating a new Maven project from existing sources in the WSL 2 directory. [IDEA-265641]
- Fixed the bug causing the IDE to crash at startup. [IDEA-270326]
- Fixed the issue that led to confirmation dialogs being displayed incorrectly. [IDEA-271191]
Those are the most significant changes we have for week four. You can check out all the fixed and improved issues included in this build in the release notes. Stay tuned for more updates next week! For now, you can test the exciting new features and share your feedback in the comments to this post or report bugs, if any, to our issue tracker.