IntelliJ IDEA 2018.1 Public Preview
IntelliJ IDEA 2018.1 Public Preview
IntelliJ IDEA 2018.1 is finally out for public preview! Check out the latest enhancements for code completion, version control, Groovy, Android development, and more!
Join the DZone community and get the full member experience.Join For Free
Get the Edge with a Professional Java IDE. 30-day free trial.
Good news everyone! IntelliJ IDEA 2018.1 is now ready for Public Preview! The upcoming IntelliJ IDEA 2018.1 brings 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
In the upcoming IntelliJ IDEA 2018.1, there are enhancements to the code completion. Now completion in the Stream API chains is aware of the type casts. The code completion not only suggests 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
With the upcoming IntelliJ IDEA 2018.1 release we’ve improved our data flow analysis so now it detects a wider variety of potential problems in your code.
First of all, the 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 for the data flow analysis in the upcoming release is that it 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 to detect and then remove some redundant code.
The IDE also warns you about modifications of immutable collections.
If you are interested, you can read this blog post with more detailed information about the enhancements in data flow analysis.
As always, the upcoming IntelliJ IDEA 2018.1 has a bagful of new inspections and quick fixes. Now, the IDE detects and warns you about the 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 detects while-loops with a conditional break at the end or beginning of an infinite loop. The IDE now 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.
The IDE now gives you the ability to 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. 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 the 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. The IDE 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 IntelliJ IDEA gives you the ability to group all the suggested quick-fixes by their quick-fix type under 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 give you the ability to include 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.
With IntelliJ IDEA you can generate a test class, and by default, the IDE will add the Test suffix to the test class name. Now you have the ability to customize a test class template to make it possible to create a test class with a Test prefix in the test class name: Preferences | Editor | Code Style | Java | Code Generation.
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 the 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.
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
--target options with Java 9 and link against Java 9 classes at the same time you now can disable the new checkbox.
Also now there is a new ability to use a specific version of the ECJ compiler. Select Eclipse from the Use Compiler drop-down menu, and in the field specify the path to jar with the needed compiler.
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; now the IDE 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.
The upcoming IntelliJ IDEA 2018.1 gives you the ability to quickly find a problem in your code. 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.
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 the Spring Boot applications.
The upcoming IntelliJ IDEA now gives you the ability to change qualified names for several modules at once by using the new Change Module Names… action from the context menu of the Project Structure dialog.
The upcoming IntelliJ IDEA 2018.1 has the ability to preview a regex replacement in the Replace in Path window.
Structural Search Enhancements
We have improved our Structural Search feature to give you the ability to 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.
For Groovy files and modules a new refactoring action is available from the context menu in the Refactor | Convert to @CompileStatic.
The Convert to @CompileStatic action annotates every groovy class in the scope of the @CompileStatic annotation.
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, with the following major new ones:
First of all, IntelliJ IDEA now supports the latest Android Oreo APIs, and lets you build Java 8 Android applications, as well as Kotlin Android applications.
Furthermore, now the IDE supports Gradle 3.0.0 for Android applications.
The Layout Editor has been improved: 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 the ability to build Instant Apps – lightweight Android apps that can be run without installation. To start 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 & Behaviour | 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 has also merged the 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 the support for partial Git commits (git add -p). IntelliJ IDEA now provides you with the ability 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 needed code chunks to a commit – use the checkboxes in the gutter in the Diff pane of the Commit Changes dialog.
To move the code chunks between changelists use the Move to another changelist action from the context menu of the Diff pane in the Commit Changes dialog.
As another option, the IDE gives you the ability to add code chunks to a changelist from the editor by simply clicking on a change marker in the gutter.
Furthermore, the upcoming IntelliJ IDEA 2018.1 includes the ability to toggle the grouping of your local changes in the Local Changes tab of the Version Control Tool Window via the new Group by icon. Use to group local changes according to their: directory, module or repository. The IDE now gives you the ability to select one of the grouping options or all three at once.
There are several improvements in the Log tab – the tab which is 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 performance of the History for revision tab. Also this tab now has a new UI.
Also, 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 the new default Alt + Cmd + K (macOS) or Alt + Ctrl + K (Windows and Linux) shortcut to perform the Commit and Push…action from the Commit Changes dialog.
Moreover, the Clone Repository dialogs for Git and GitHub have been merged into one. Also, the autocompletion for the GitHub repositories is working in the new Clone Repository dialog. You just need to log in to your GitHub account using the Log in to GitHub… button.
Also, the SVNKit library has been removed. You can find more information in the dedicated blog post.
Enhancement 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 provides you with the ability to open methods with @RequestMapping annotations via the new REST client.
- 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 invoking from Select In pop-up and many others, check 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!
We have tons of improvements coming with 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, Twitter or in the comments below.
Published at DZone with permission of Zlata Kalyuzhnaya , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.