IntelliJ IDEA
IntelliJ IDEA – the Leading Java and Kotlin IDE, by JetBrains
IntelliJ IDEA 2018.1 Public Preview
Good news everyone: IntelliJ IDEA 2018.1 is now ready for Public Preview! The upcoming v2018.1 will bring a lot of important improvements: support for Git partial commits, inline external annotations, merged features from Android Studio 3.0, and many more. We are excited about all these new features, and we encourage you to take the preview build for a ride right away!
Enhancements in code completion
Now completion in the Stream API chains is aware of the type casts. The code completion suggests not only a completion item according to the existing call filter(String.class::isInstance), but also an automatically typecasted completion item.
We have also improved the postfix code completion in the upcoming release. Now the IDE allows you to create your own Java templates or edit and rename some of the predefined Java templates at Preferences | Editor | General | Postfix Completion.
Improvements in data flow analysis
We’ve improved the data flow analysis to detect a wider variety of potential problems in your code.
First, data flow analysis now tracks relations between variables like “greater than” and “less than”. The IDE detects when a condition is always true (or false) in all the possible code paths when the variables are compared.
Another enhancement is data flow analysis now works for non-terminated stream API chains.
The IDE will now warn you when you try to assign a variable to the same value it already contains. This may help you detect and then remove some redundant code.
The IDE also warns you about modifications of immutable collections.
Read this blog post for more details an all the enhancements in data flow analysis.
As always, the upcoming 2018.1 release has a bagful of new inspections and quick fixes. Now, IntelliJ IDEA detects and warns you about while-loops with an idempotent body, as in most cases this indicates a programming error and can lead to a program hang.
Also, the IDE now detects while-loops with a conditional break at the end or beginning of an infinite loop. It offers a quick-fix to replace a break condition with a loop condition, because in most cases it’ll make your code look clearer.
The upcoming IntelliJ IDEA now warns you about any infinite streams that weren’t short-circuited, as such operations can be completed only by throwing an exception. Such code may result in an infinite loop or a running out of memory issue.
You can now sort the array content alphabetically.
If there is a copy constructor that doesn’t copy all the fields in a class, you’ll get a notification about it. Note that the IDE considers fields with a transient modifier unnecessary to copy.
The upcoming IntelliJ IDEA now warns you about an explicitly redundant close() call and provides a handy quick-fix to remove it.
The upcoming IntelliJ IDEA features Java 9 specific inspections and quick-fixes. The IDE checks that a service loaded by ServiceLoader is declared in the module-info.java file and provides a quick-fix to add a missing statement to the module-info.java file.
For an unresolved class mentioned in module-info.java, the IDE now suggests creating that missing class. It suggests creating missing exported packages as well. (The IDE creates the package with the class in the required directory, as you can’t export an empty package in Java 9.)
Now when there are several different approaches on how to fix possible problems in the chosen scope, you can group all the suggested quick-fixes by their quick-fix type. To do this, click the Fix partially button in the Inspection Results Tool Window.
JUnit 5 @Tag annotation support
The upcoming IntelliJ IDEA 2018.1 now supports the JUnit5 @Tag annotation to let you include it in the testing scope, tagged classes, and tagged methods. Select the Tags (JUnit 5) option in the test kind field in the Run/Debug Configuration dialog. Use the Uniqueld field to filter tests according to their id.
Code Generation
When you generate a test class in IntelliJ IDEA, by default it adds the Test suffix to the test class name. Now it’s possible to customize a test class template so that a test class is created with a Test prefix in the test class name. Adjust this in Preferences | Editor | Code Style | Java | Code Generation.
JVM Debugger
The new Throw Exception action now allows you to throw an exception from a certain location in your program without changing the code. It is available from the Run | Throw Exception menu, or the frame context menu during a debugging session.
Print breakpoint stacktraces
The upcoming IntelliJ IDEA 2018.1 allows you to print breakpoints Stacktraces to the console. You can enable the Stacktrace option in the Breakpoints dialog box. The IDE also provides you with an ability to observe multiple breakpoints Stacktraces at the same time in the Console log.
Also, you can now copy the current thread stack trace via a new Copy Stack action which is available from the frame context menu.
Java Compiler
There is a new Use --release
option for cross-compilation (Java 9 and later) check-box on the Java Compiler page at Preferences | Build, Execution, Deployment | Compiler | Java Compiler that is enabled by default. When you need to use the --source
and --target
options with Java 9 and link against Java 9 classes at the same time you now can disable the new checkbox.
Now you can also use a specific version of the ECJ compiler. Select Eclipse from the Use Compiler drop-down menu, and specify the path to the jar with the compiler.
Editor
In IntelliJ IDEA, you can annotate your code with external annotations even when direct annotation of the source code is not possible (library classes). You can configure your annotations in the annotations.xml files, which are stored outside of your source code.
Previously, the IDE only showed the @ icon in the gutter near the externally annotated code, but now it shows these external annotations inline in your code.
IntelliJ IDEA now lets you view the automatic inferences of @NotNull or @Nullable annotations right in your source code (not only in the gutter icon near the inferred annotation, as it was before). You can enable the Show inferred annotations inline check-box in the Preferences | Editor | General | Appearance.
If there are any problems in your code, the upcoming IntelliJ IDEA 2018.1 will let you find them quickly. The IDE now highlights the folded code regions that contain errors or warnings, and colors such blocks according to their validation status.
The IDE also highlights the folded code regions if they contain any matching occurrences when you search through the current file.
When you place the caret on an identifier and the IDE highlights its usages, you can now use the new Alt + Wheel down or Alt + Wheel up shortcuts to jump to the next or previous identifier occurrence.
Project Configuration
There is a new Include dependencies with “Provided” scope option for the Application and Spring Boot configurations in the Run/Debug Configurations dialog. This new feature allows you to add “provided” dependencies to the classpath when needed. Please note that the Include dependencies with “Provided” scope option is enabled by default for Spring Boot applications.
The new release will also let you change qualified names for several modules at the same time, by using the new Change Module Names… action from the context menu of the Project Structure dialog.
Replace improvements
In IntelliJ IDEA 2018.1, you’ll be able to preview a regex replacement in the Replace in Path window.
Structural Search enhancements
We’ve improved Structural Search to help you find method calls to annotated methods. In the Structural Search dialog, you can create your own search template or choose from the existing search templates. In the following example, the Structural Search finds all method calls to methods marked as @Deprecated.
Groovy
For Groovy files and modules, a new refactoring action is available from the context menu in Refactor | Convert to @CompileStatic.
The Convert to @CompileStatic action annotates every groovy class in the scope of the @CompileStatic annotation.
Android
Here is some long awaited news for Android Developers! The upcoming IntelliJ IDEA 2018.1 merges the changes from Android Studio 3.0 and brings in dozens of new features. Here are the major new ones:
First, IntelliJ IDEA now supports the latest Android Oreo APIs, and lets you build Java 8 Android applications as well as Kotlin Android applications.
Second, the IDE now supports Gradle 3.0.0 for Android applications.
The Layout Editor has been improved with a new toolbar layout and icons, updated layouts in the component tree, a new error panel, and more.
Now you can create App Icons with the updated Image Asset Studio. Right-click the res folder in your Android project, and select New | Image Asset from the context menu. In the Asset Studio window, select Launcher Icons (Adaptive and Legacy) as the icon type.
The IDE now supports building Instant Apps – lightweight Android apps that can be run without being installed. Before building Instant Apps, make sure that the Instant Apps Development SDK is installed. You can check which SDK tools are installed if you need to, in Preferences | Appearance & Behavior | System Settings | Android SDK in the SDK tab.
The new Device File Explorer Tool Window displays the file and directory structure of your Android device or emulator. Use the Device File Explorer Tool Window to view, copy, or delete files on an Android device. You can access it through View | Tool Windows | Device File Explorer.
The upcoming IntelliJ IDEA 2018.1 also merges Android Profiler – a brand new suite of profiling tools that provide real-time data for your app’s CPU, memory, and network activity.
To learn more, please refer to the Android Studio Release Notes.
Version Control System
One of the highlights of the upcoming release is support for partial Git commits (git add -p). IntelliJ IDEA will allow you to associate the code chunks with a changelist. Create a changelist, put all the needed code chunks there, and then commit it. The IDE now commits only the selected changes from the file and skips all other changes.
To add the required code chunks to a commit, use the check-boxes in the gutter of the Diff pane in the Commit Changes dialog.
To move code chunks between changelists, bring up the context menu of the Diff pane in the Commit Changes dialog, and then click Move to another changelist.
As another option, the IDE lets you add code chunks to a changelist from the editor by simply clicking a change marker in the gutter.
Furthermore, the upcoming IntelliJ IDEA 2018.1 includes an ability to toggle the grouping of your local changes. To do this, go to the Local Changes tab of the Version Control Tool Window and look for the new Group by icon. Use it to group local changes by directory, module, or repository. Now you can select either a single grouping option, or all three at once.
There are several improvements in the Log tab – the tab that’s available for Git and Mercurial VCS. The Commit Details pane of the Log tab has been redesigned. Now you can quickly navigate to a commit in the Log by clicking the corresponding commit hash in the Commit Details pane.
For Git integration, we’ve improved the performance of the History for revision tab. The tab also has a refreshed UI.
The Abort Rebase, Continue Rebase, and Skip Commit actions are now available from the Git Branches pop-up if there is an ongoing rebase process.
The IDE has a new default shortcut to perform the Commit and Push… action from the Commit Changes dialog. Please use Alt + Cmd + K (on macOS) or Alt + Ctrl + K (on Windows and Linux).
Moreover, the Clone Repository dialogs for Git and GitHub have been merged into one. Autocompletion for GitHub repositories is now available in the new Clone Repository dialog. You just need to log in to your GitHub account using the Log in to GitHub… button.
We’ve also removed the SVNKit library. See this blog post for more details.
Enhancements in Docker Compose
The Docker Compose workflow has been improved. The Run/Debug Configurations dialog for the Docker Compose run configuration has been improved to make it possible to use important Docker Compose features such as support of multiple compose files, and the ability to choose a service to run.
The Docker plugin now supports Multiple Docker Compose files and respects not only a docker-compose.yml, but also an optional docker-compose.override.yml file. You can add the docker-compose.override.yml as any other override file, right after the base configuration file.
For Docker Compose files, you can now define an environment variable in the updated Run/Debug Configurations dialog. Also, if you want to use the --build
command line options, enable the Force build checkbox.
The Docker plugin allows you to choose the set of services to run after you choose configuration files in the Docker Compose Run configuration.
The Spring Boot enhancement
- Support for Spring Boot Devtools.
- A new gutter icon lets you open methods with @RequestMapping annotations via the new REST client.
OTHER
- The IDE automatically resizes the graphics to fit the window.
- During the import of an Eclipse project, IntelliJ IDEA is now able to import your code style configuration.
- There is a new Open in terminal action that launches the integrated terminal on the folder’s path.
- Better HiDPI support on multiple displays for Windows.
Also, the JDK has been updated to 1.8.0_152-release-1136-b16, with the following fixes integrated:
- Follow-up fix for the issue with running IDE on 32-bits Windows JRE-590.
- Position of IME Composition windows was fixed JRE-668, JRE-669.
- The issue with displaying UI after changing DPI was fixed JRE-660.
With the upcoming IntelliJ IDEA 2018.1, we have completely reworked our focus subsystem. Many focus-related issues have been already fixed, such as: the Search Everywhere pop-up that now receives focus, and the Project tool window that now receives focus when invoked from the Select In pop-up and many others. Please check out this link. We expect that with the updated focus subsystem we can fix focus related issues much faster.
A big thanks for all the bug reports, please keep them coming!
Last but not least, the built-in SSH executable is now compatible with the new GitHub cryptographic standards. Learn more here.
You can look through the full list of v2018.1 changes in the Public Preview release notes.
Here are the release notes for the 181.3986.9 build.
As this post has hopefully demonstrated, tons of improvements are coming in the upcoming release. Download the IntelliJ IDEA 2018.1 Public Preview build and see for yourself! We welcome your feedback, so please reach out to us in the EAP discussion forum, issue tracker, on twitter, or in the comments below.
Happy Developing!