Java

Enhancements in code completion

Completion in the Stream API chains is now aware of type casting. Code completion can not only suggest a completion item according to the existing call filter (String.class::isInstance), but also for an automatically typecast completion item.

Data flow analysis

We’ve improved our data flow analysis so it can now track the relationships 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.

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 data flow analysis now works for non-terminated stream API chains.

The IDE will also warn you about modifications to immutable collections.

learn more

Missing ServiceLoader declaration

IntelliJ IDEA 2018.1 has new Java 9 inspections and quick-fixes. The IDE now checks that a service loaded by ServiceLoader is declared in the module-info.java file, and will offer a quick-fix to add a missing statement to the module-info.java file.

learn more

Creating missing class

For an unresolved class mentioned in module-info.java, the IDE will suggest creating the missing class, and create missing exported packages as well. Note the IDE creates the package with the class in the required directory, as you can’t export an empty package in Java 9.

Idempotent body detection

The IDE will detect and warn 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.

Move break-condition of infinite loop to loop condition

For while-loops, now you get a 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.

Explicitly redundant close() call

IntelliJ IDEA now detects an explicitly redundant close() call of the resource at the end of a try-with-resources block.

Infinite Stream detection

IntelliJ IDEA will warn 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.

Copy constructor with missing fields detection

In IntelliJ IDEA 2018.1 you’ll get a notification if there is a copy constructor that doesn’t copy all the fields in a class. The IDE considers fields with a transient modifier unnecessary to copy.

Sort array content

A new Sort content action is available in array initializers and varargs. This new action sorts content alphabetically.

User Postfix Completion template

The postfix code completion has been improved. The IDE now lets you create your own Java templates or edit and rename some of the predefined Java templates through Preferences | Editor | General | Postfix Completion.

Fix partially in Inspection Results

A new Fix partially button has been added to the right-hand pane of the Inspection Results Tool Window. It appears when you have several options for fixing 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 in one go.

Test prefix in Code Generation

In IntelliJ IDEA you can generate a test class using the intention action. With 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.

JUnit 5 @Tag annotation support

IntelliJ IDEA 2018.1 now supports the JUnit5 @Tag annotation so now you can include tagged classes and tagged methods, in the testing scope. 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.

JVM Debugger

Throw Exception

IntelliJ IDEA 2018.1 has a new Throw Exception action that 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 from the frame context menu during a debugging session.

Logging stacktrace to console

The IDE now allows you to print breakpoints stack traces to the console. You can enable the stack trace option in the Breakpoints dialog box. In IntelliJ IDEA, you can now observe multiple breakpoints stack traces at the same time in the Console log.

Copy current thread stacktrace

You can now copy the current thread stack trace via a new Copy Stack action which is available from the frame context menu.

Annotations for Async stack traces

With IntelliJ IDEA 2018.1 we’ve extended the Async stack traces feature so that you can now use the @Async.Schedule and @Async.Execute annotations to set up capture points that are not included in the default configuration. You just need to add Maven artifact as a dependency.

Java Compiler

There is a new Use --release option for cross-compilation (Java 9 and later) checkbox 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 can disable this checkbox.

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 jar with the chosen compiler.

Editor

Folded code highlighting

If any issues have been detected in your code, now you can find them quicker than before. The IDE now highlights the folded code regions that contain errors or warnings, and colors such blocks according to their validation status.

Highlights the folded code regions with the search results

The IDE also highlights folded code regions if they contain any matches when you search through the current file.

Inline external annotations

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.

Inferred Annotation Hints

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 checkbox in the Preferences | Editor | General | Appearance.

Project Configuration

Add “provided” dependencies to classpath

A new Include dependencies with “Provided” scope checkbox has been added 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 the Spring Boot applications, the Include dependencies with “Provided” scope option is enabled by default.

New Change Module Names... action

With IntelliJ IDEA, you can now change qualified names for multiple modules all at once. This is done via the new Change Module Names… action, from the context menu of the Project Structure dialog.

Search and Replace

Structural Search enhancement

With IntelliJ IDEA 2018.1, you can find method calls to annotated methods using Structural Search. You can select them from the existing search templates or create your own.

Replace in Path improvements

IntelliJ IDEA 2018.1 has the ability to preview a regex replacement in the Replace in Path dialog.

Kotlin

The Kotlin plugin bundled with the IDE has been updated to Kotlin 1.2.30

Pasting Kotlin code into a package

Now, in the Project Tool Window, you can paste a code fragment directly into a package, and the IDE will create a new Kotlin file with the pasted code.

Intentions for converting the scoping function calls

The Kotlin Plugin now offers new intentions that convert the scoping function calls let and run into each other, as well as also into apply and vice versa.

Groovy

New Convert to @CompileStatic refactoring action

Now you have a new action that’s very useful when you want to keep your code in Groovy and at the same time benefit from static compilation. To save you a lot of time migrating from existing Groovy code, this new refactoring annotates every groovy class in the scope with the @CompileStatic annotation.

This new refactoring action is available from the context menu Refactor | Convert to @CompileStatic.

learn more

Unnecessary import alias

IntelliJ IDEA 2018.1 reports unnecessary import alias for Groovy files. This new warning also works on static imports.

Scala

Inline hints

The editor can now show inline hints for parameter names, method result types, and variable types. You can also easily use the settings to customize when such a hint should be shown.

Structure View improvement

The Structure View now shows much more information about code. It displays final, abstract and access modifiers, nested definitions, primary constructor types, case class parameters as members, etc. The Structure View also provides you with an option to show all inherited members with their original class.

Refactoring: Inline function parameters

The refactoring is now capable of inlining functions with parameters. It correctly substitutes them with actual values.

Android

IntelliJ IDEA 2018.1 merges the changes from Android Studio 3.0 and includes dozens of new features, with the following major new ones

Layout Editor improvements

The Layout Editor has been improved: there is a new toolbar layout and icons, updated layouts in the component tree, a new error panel, and more.

Brand new profiling tools

IntelliJ IDEA 2018.1 now includes Android Profiler, a brand new suite of profiling tools that provide real-time data for your app’s CPU, memory, and network activity.

Device File Explorer Tool Window

The new Device File Explorer Tool Window displays the file and directory structure of your Android device or emulator. Use this tool window to view, copy, and delete files on an Android device. You can access it through View | Tool Windows | Device File Explorer.

Build Instant Apps

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 in Preferences | Appearance & Behavior | System Settings | Android SDK in the SDK tab.

Spring Boot

Access HTTP request mappings from the editor via the new REST client

Now, after you run a Spring Boot web application, a new icon is shown in the gutter for methods with @RequestMapping annotations that handle incoming HTTP requests. Click this gutter icon to open all the mappings in a scratch file with an .http extension and perform an HTTP request in the editor via the new REST client.

For methods with @GetMapping annotations, you have the choice to open the mapped URLs in a browser, or open a request in the HTTP Request Editor.

Note, that you need to add the dependency for the spring-boot-starter-actuator to your pom.xml or build.gradle file.

New gutter icons for beans registered in the application context

IntelliJ IDEA shows all the beans that are registered in the application context in the Beans tab in the Run Dashboard (or in the Run Tool Window). We’ve extended this functionality, and now this information is also available in the editor. The new gutter icons are shown next to the beans that are used at runtime.

Click these new gutter icons to navigate to the dependent beans.

Version Control

Partial Git commits

IntelliJ IDEA 2018.1 supports partial Git commits (git add -p). The IDE lets you associate the code chunks with a changelist. Create a changelist, put all the needed code chunks there, and then commit it. The IDE will now only commit the selected changes from the file and will skip all other changes. To add the 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.

Alternatively, add code chunks to a changelist from the editor by clicking on a change marker in the gutter.

Toggle grouping of local changes by directory, module, or repository

With IntelliJ IDEA 2018.1, you can choose how to display your local changes by grouping them according to their directory, module, or repository. Use the new Group by icon available in the Local Changes tab in the Version Control Tool Window. Note that now you can select one of the grouping options or all three at once if needed.

Navigate by clicking on the commit hash

In the Log tab inside the commit detail panes, the IDE now highlights hashes of the commits you are referring to. By simply clicking commit hashes you can jump to that commit in the Log tab. This works for Git and Mercurial. Also, the Commit Details pane of the Log tab has been redesigned

History for revision tab enhancement

IntelliJ IDEA lets you view detailed information about file changes by invoking the Show History for a Revision action on a file in the Log tab (available for Git integration). In 2018.1, we’ve updated the History for revision tab so that now it works much faster. In addition to better performance, this tab has a refreshed UI resembling the Log tab.

Clone Repository

Moreover, the Clone Repository dialogs for Git and GitHub have been merged into one.

Autocompletion for GitHub repositories also works in the new Clone Repository dialog. You just need to log in to your GitHub account by clicking Log in to GitHub.

New shortcut for the Commit and Push… action

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).

Git Branches pop-up

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.

User Interface

New documentation UI

We’ve updated the Quick Documentation pop-up and made it clearer and more compact. Information about the method’s parameters, type, and return type is now available for Java, JavaScript, and TypeScript in the updated Quick Documentation pop-up

Better HiDPI support

When you run the IntelliJ IDEA 2018.1 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. To switch back to the default mode, you need to set-up the VM option -Dsun.java2d.uiScale.enabled = false

JavaScript & TypeScript

TypeScript improvements

IntelliJ IDEA now supports the latest TypeScript 2.7 features, improves the Implement Members action, and adds the new Surround with type guard quick-fix for unresolved properties.

Create a new Vue project

With the Vue.js plugin installed in IntelliJ IDEA, you can use Vue CLI, an official tool for scaffolding Vue apps, to create new Vue projects. To install Vue CLI, run npm install --g vue-cli in the terminal.

Reformat with Prettier

IntelliJ IDEA supports Prettier, an opinionated code formatter via Prettier plugin. After you have the prettier package installed, the new Reformat with Prettier action will become available in IntelliJ IDEA. You can format the selected code, a file, or a whole directory using Prettier.

Hunspell

Hunspell dictionary support

The Hunspell plugin that provides Hunspell dictionary support is now compatible with IntelliJ IDEA. Compared to a plain list of words, Hunspell provides significantly faster and much more accurate misprint detection, with far fewer false positives.

learn more

Docker

Enhancement in Docker compose

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 docker-compose.override.yml as you would any other override file, right after the base configuration file.

Docker compose services

The Docker plugin allows you to choose the services to run just after choosing the configuration files in the Docker-compose run configuration.

The plugin shows all the existing Compose projects, not only the ones deployed via the Docker-Compose run configuration.

Kubernetes

Support for YAML Kubernetes resource files

The brand new Kubernetes plugin supports the Kubernetes resource files from v1.5 up to the recently released v1.9. The new plugin will look for the presence of apiVersion and other fields of this kind in the files, and if these are present, it will consider such files as Kubernetes resource files.

learn more

Completion in YAML Kubernetes resource files

To help you really quickly create the required YAML definition file for Kubernetes, start typing the required key and invoke Smart Completion. The new plugin will auto-complete all the required keys from all the levels below.

Code completion now works for YAML Kubernetes resource files. The Kubernetes plugin offers the correct values you can use within the resources.

Kubernetes Live Template

The Kubernetes plugin has a built-in Live Template that allows you to quickly create the type of YAML Kubernetes resource file that you need. The new plugin now contains several predefined Kubernetes templates, and you can invoke the necessary Live Template by typing its abbreviation.

Navigation in YAML Kubernetes files

Use gutter icons to quickly navigate between a label definition and a label selector.

Jump from a label selector to a label definition inside the editor if there is a direct match for a label, both for the key and for the value.

Inspections for YAML Kubernetes files

The Kubernetes plugin will alert you whenever you select deprecated Kubernetes properties.

Also, you’ll get a warning for YAML files if you try to use properties that are not applicable for the specified elements with the applied apiVersion and kind of field.

Quick-fixes for YAML Kubernetes files

The plugin highlights elements with missing keys in YAML Kubernetes resource definition files and provides a quick-fix to add the required keys.

Also, you'll get a warning about redundant keys. Use the provided quick-fix to remove redundant keys in YAML Kubernetes resource files.

The new plugin also detects non-editable keys in YAML Kubernetes resource files and highlights them in the editor. Note that there’s an easy way to remove all such read-only keys from the current YAML file – with a handy quick-fix.

Support for JSON Kubernetes resource files

The new plugin provides some support for JSON Kubernetes resource files based on the JSON schema functionality.

Code completion and the Quick Documentation Popup are also available for JSON Kubernetes resource files.

Inspections for JSON Kubernetes resource files

The new Kubernetes plugin validates the current keys according to the JSON schema and alerts you when incorrect properties or values are used.

Also, the plugin highlights elements with any missing required properties and then advises you about the appropriate properties that should be added.

Duplicated properties are also detected in JSON Kubernetes files.