BT

Ready for InfoQ 3.0? Try the new design and let us know what you think!

IntelliJ IDEA 2018.2 Supports Java 11, MacBook Touch Bar and More

| by Diogo Carleto Follow 46 Followers on Aug 29, 2018. Estimated reading time: 4 minutes |

JetBrains recently released version 2018.2 of their flagship IntelliJ IDEA product. This version brings support for the upcoming Java 11, breakpoints intentions, the MacBook Touch Bar, enhancements for Spring Boot, Scala and Docker plugin, and more.

Java

IntelliJ IDEA 2018.2 supports the new local-variable syntax for lambda parameters (JEP 323), a new feature of the upcoming Java 11, which is due in September. Developers can now use var in lambda expressions.

//Java 8, without var  
BiConsumer<Processor, String> consumer = (Processor x, String y) -> x.process(y);

//Java 11 using var
BiConsumer<Processor, String> consumer = (var x, var y) -> x.process(y);

Along with support for the use of var in Java 11, holding Ctrl/⌘ and hovering over the var will show the type of variable.

Now IntelliJ IDEA displays type hints for long method chains. This can be useful for developers who want to see the type of each call as a type hint for long method chains with generics.

A new preview panel has been added for the Extract Method refactoring, allowing developers to see what the results of refactoring will look like before confirming changes.

IntelliJ IDEA has enhanced the support to the @org.jetbrains.annotations.Contract annotation, which enables developers to specify a method reaction when a particular parameter is passed.This can help with nullability analysis and some other inspections. The new values supported are new - method should return a non-null new object; this - method should return non-null this reference; and paramX - method should return X-th argument.

Stream API support has also been improved, indicating that sorting is unnecessary or that using a collector or collection is wrong. Furthermore, there is a new warning about redundant distinct() calls before collect(toSet()).

Debugging Java projects has also seen a number of improvements. With a single Alt+Enter key combination, along with all other available intentions, developers can see three new breakpoint intentions: stop only in class, do not stop in class, and stop only in the current object. In addition, there is a new Caller filter that allows developers to only stop at a breakpoint if it's called from a specified method, or skip a breakpoint if it's called from that method.

User Interface

A series of improvements related to user interface have also shipped with the new version. MacBook Touch Bar is now directly supported, and IntelliJ IDEA buttons are displayed in the middle of the Touch Bar interface, allowing developers to run, debug, commit changes, and update projects right from the Touch Bar. Still on the topic of macOS, it's now possible to make the title bars darker, and new icons have been added. The IntelliJ theme on Linux has also been updated.

Scala

IntelliJ IDEA brings several improvements to the Scala plugin. Developers can see implicit conversions and arguments as inline hints, with navigation and extended information in a tooltip. The Scalafmt formatter is now part of the Scala plugin; to configure it, click Preferences/Settings > Editor > Code Style > Scala.

The autocompletion for type annotation and pattern matching has also been improved. Now the Scala plugin suggests a list of typed patterns for classes and interfaces when applicable, as in the following example:

JavaScript / Typescript

Some improvements have also been added for JavaScript and Typescript. Developers can create a new React component by using the new Extract Component refactoring. Unused JavaScript/TypeScript code on the client side can now be found by using the new Code Coverage feature and performing manual functional testing. To use it, developers need to start a JavaScript Debug configuration with coverage and interact with the app in Chrome. After stopping the configuration, IntelliJ IDEA will show a coverage report in the Coverage tool window.

A series of JavaScript and TypeScript intentions are now available, such as Implement interface, Create derived class, Implement members of an interface or abstract class, Generate cases for 'switch', and Iterate with 'for..of'.

Spring

A new Spring Integration Diagram has been added, which basically shows what has been configured for the application using XML or Java annotations, such as gateways, channels, bridges, etc.

Some improvements have been provided for Spring Boot apps. The new Diagram Mode allows developers to visualize the dependencies between runtime beans of a Spring Boot application. And from Run Dashboard, developers can manage HTTP requests mappings.

Docker

The Docker plugin continues to mature and now allows features such as wrap word in Docker logs by using the new Use Soft Wraps action. Developers can also navigate from compose nodes and containers to the corresponding compose and docker files. Furthermore, it is now possible to define a base directory for executing Docker build command for a Dockerfile.

More information and a full set of changes can be found on the What's New page.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss
BT