IntelliJ IDEA
IntelliJ IDEA – the Leading Java and Kotlin IDE, by JetBrains
IntelliJ IDEA starts 2018.1 Early Access Program
We are pleased to announce the start of the Early Access Program for our next major release – IntelliJ IDEA 2018.1! The first IntelliJ IDEA 2018.1 EAP build is already available for download, and it brings you lots of improvements and a full bag of new features. If you want to know more about the highlights of the release planned for this spring – read this blog post.
Java
In the upcoming IntelliJ IDEA 2018.1 code completion was improved. In particular, now completion in the Stream API chains are aware of the type casts, and suggests completion item according to the existing call: filter(String.class::isInstance)
. The completion item will then be automatically type casted.
As always, the upcoming update of our IDE brings tons of new inspections. Now IntelliJ IDEA helps you write clear code, and detects even more cases where redundant code constructs are used.
In the first IntelliJ IDEA 2018.1 EAP build all the older inspections that detect a redundant string operation have been merged into a single Redundant String operation
inspection. And here is the exact and complete list of inspections which were merged: Redundant 'String.toString()'
, Redundant 'substring(0)' call
and Call to 'intern()' on String constant
.
Also new scenarios are now covered: such as StringBuilder("")
, sb.append("")
or System.out.println("")
.
The IDE now reports unnecessarily complex collection operations. The IntelliJ IDEA 2018.1 EAP build provides quick-fixes and suggests simpler alternatives.
A new Sort content action is now available in array initializers or varargs. This new action sorts content alphabetically.
The IntelliJ IDEA 2018.1 EAP build introduces a new Idempotent loop body inspection that detects possible code errors in the while-loops, for which only the initial assignment and the first iteration matter, and the following iterations do not. In most cases this is a programming error, as it causes an infinite loop if the condition is still true after the first iteration.
The upcoming IntelliJ IDEA 2018.1 detects a copy constructor that doesn’t copy all fields in a class. The IDE considers fields with the transient modifier unnecessary to copy.
Now the IDE detects and warns you about the infinite streams that weren’t short-circuited. Such code may result in an infinite loop or a running out of memory issue.
Also, you will get a warning about modifications of immutable collections.
For while-loops, now you get the notification about a conditional break at the end or beginning of an infinite loop. The IDE will suggest moving a break condition to a loop condition and offer a quick fix to modify your loop. Usually replacing a conditional break with a loop condition makes the code clearer.
In the right-hand pane of the Inspection Results Tool Window, a new Fix partially button has been added. It appears when you have several different ways to fix possible problems in the chosen scope. All the suggested quick-fixes are grouped by the quick-fix type under the Fix partially button. This new feature allows you to apply the required quick-fix to the chosen scope, and fix all affected cases at once.
JUnit 5 @Tag annotation support
A new @Tag annotation has been added to the JUnit5 testing framework, to mark class or method for filtering tests. We implemented support for the @Tag annotation in the IntelliJ IDEA 2018.1 EAP build, so now you can run tests filtered by tags. In the Run/Debug Configuration dialog, select Tags (JUnit 5) in the test kind field and the IDE will only include in the testing scope tagged classes and tagged methods. Also, you can use Uniqueld field to filter tests according to their id.
JVM Debugger
We have a tradition of improving our debugger with each release, and the upcoming IntelliJ IDEA 2018.1 is no exception. Speaking about exceptions, we’ve just added an ability to throw an exception without actually adding any code to your project during a debugging session.
The new Throw Exception action lets you throw an exception from a certain location without altering the code. While in a debugging session, you can access this new action through the Run | Throw Exception menu, or from the frame context menu.
Breakpoints Stacktraces
With the upcoming IntelliJ IDEA 2018.1, you can now print breakpoints Stacktraces to the console: just select the Stacktrace checkbox in the Breakpoints dialog box.
You can also select to print several breakpoints’ Stacktraces to the console, and then observe all breakpoints Stacktraces at once in the Console tab after the execution of your program has finished.
Project Configuration
A new Include dependencies with “Provided” scope checkbox appeared in the Run/Debug Configurations for the Application and Spring Boot configurations.
This new option will be useful if you have the “provided” dependencies for the scope in your project, but you run your application both inside a container (where “provided” dependencies are supplied by the container) and outside a container (where “provided” dependencies are not automatically supplied). For example:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
With this new feature, you can easily add “provided” dependencies to the classpath when needed. So now, if you need to test, debug, or run your application with “provided” dependencies within the IDE, you don’t need to install the required container for the application locally on your machine, or manually change the dependencies.
For the Spring Boot applications the Include dependencies with “Provided” scope option is enabled by default.
Code Generation and Navigation
In IntelliJ IDEA you can generate a test class using the intention action. With the IntelliJ IDEA 2018.1, you can customize a test class template and create a test class with Test as a prefix. Go to Preferences | Editor | Code Style | Java | Code Generation, and choose how the test class name should be generated. By default, the IDE creates a test class with the Test as a suffix.
Search and Replace improvements
In the Replace in Path window now the IDE provides an ability to preview a regex replacement.
Structural Search enhancements
Now you can find method calls to annotated methods using Structural Search. You can select from the existing search templates or create your own.
We have significantly improved the Structural Search performance in XML and HTML files, also we have sped up the Java search. Search and replace in Javascript has been improved as well. We’ve fixed a bunch of bugs, so now you’ll be getting more relevant results. Code constructs that previously did not appear in search results can now be found. Expressions that previously could not be replaced, are now replaced. And incorrect search patterns are now reported instead of failing silently.
Injection into FreeMarker macro calls
The support for the FreeMarker template engine has been improved; now the IDE supports configurable injection into FreeMarker macro calls.
Spring Framework
The IntelliJ IDEA 2018.1 EAP build supports new features of the recently released Spring Security 5.0: Spring Framework 5 integration, Reactive Support (@EnableWebFluxSecurity, @EnableReactiveMethodSecurity, WebFlux Testing), OAuth 2.0 and others.
VCS
Now the IDE allows you to paste a branch name into the Git Branches popup while performing a search for a needed branch.
Now the force push action is enabled by default for all branches except for the protected one. The Allow force push checkbox has been removed from the Preferences | Version Control | Git.
The SVNKit library has been removed from the IDE; now Subversion 1.6 is not supported in the IntelliJ IDEA 2018.1 EAP build and integration with Subversion is possible only through an SVN client. We’ll publish a dedicated blog post with more information about the SVNKit library removal as soon as possible.
Update: the blog post about the SVNKit library removal.
Better HiDPI support on multiple displays for Windows
From now on, if you run the IntelliJ IDEA 2018.1 EAP build on Windows 8.1 (or higher), the IDE starts in per-monitor DPI-aware mode, with implemented support for the fractional scale factors of the monitor. Previously only integral scale factors were supported in the IDE. As before, to switch to the default mode, you need to set the VM option -Dsun.java2d.uiScale.enabled = false.
In other news, a new Open in terminal feature has been implemented in the upcoming IntelliJ IDEA 2018.1. Select a directory or a file in the Project Tool Window and chose the Open in terminal option from the context menu. The IDE launches the terminal session in the required directory.
Improvements are also coming for Groovy support. We plan to publish a dedicated blog post with more details pretty soon.
As usual, we have devoted a lot of time to bug fixes, and we are happy to announce that we have fixed several major bugs related to the focus subsystem. We understand that some of those issues were reported a long time ago and that they caused a lot of frustration. We’ve worked hard to solve those issues, and in order to accomplish that task we have considerably reworked our focus subsystem.
Now we believe that we can fix more focus bugs much faster than before. This took us some time, so we would like to say a big thank you for your patience and for your bug reports as well. If something doesn’t work as expected please file a new report, and will try to fix it as soon as possible. Meanwhile, take a look at what has been accomplished up to this point:
Now, the Search Everywhere pop-up receives focus: IDEA-124160.
The Project tool window receives focus when invoking from Select In pop-up: IDEA-164945.
The Version Control Tool Window receives focus after viewing diff dialog: IDEA-124651.
And here are even more notable bug fixes:
Better JavaDoc formatting: prevent re-flowing of HTML-fragments IDEA-143120.
Now, the Find in Path dialog doesn’t disappear if you click outside the dialog IDEA-168640
For Maven projects, the IDE now imports sources/test sources/resources, even if they are not in the module’s content root: IDEA-72904.
Download and try the freshly-baked EAP build, and don’t forget to tell us what you think. We are always eager to hear your feedback in our issue tracker, here in the comments, or on Twitter.
Happy developing!