IntelliJ IDEA 2017.2 is here: Discover its love for Java 9 and the wealth of new features
© Shutterstock / Le Moal
IntelliJ IDEA 2017.2 is finally here. This massive update for IntelliJ IDEA contains an abundance of features and important bugfixes. There’s Kotlin 1.1.3 support, Groovy 2.5.0 support, smarter coding assistance, Java 9 module diagrams and more.
IntelliJ IDEA 2017.2 is here and there are plenty of features that will make you fall in love with it. Before we dive into details, let’s have a look at this release’s highlights.
IntelliJ IDEA 2017.2: Quick view
Smarter code completion and control flow analysis
- Smart Completion becomes aware of builder classes and suggests chains of method calls on its first call, and the chain suggestions are sorted according to how frequently symbols are used in the current project.
- Control flow analysis now detects a wider array of problems, especially when booleans, strings, arrays, lists, and maps are involved; it also checks nullability issues when corresponding annotations are used on type parameters for collections and maps.
New inspections and refactorings
- Inspections and quick-fixes: Replace with Set.of and Add Thread#onSpinWait() (both require Java 9), and Extract set from comparison chain.
- Refactorings: Extract as Map Operation (for streams), Extract Functional Variable, and Extract Lambda to Method Reference
Java 9 module diagrams. Read more about it here.
Debugger: filtering arrays, collections, and maps
Spring Boot actuator endpoints
- The Run tool window now provides the actuator endpoint information, like Beans, Health, and Mappings.
Kotlin 1.1.3 support
- The editor can now display Parameter hints (introduced earlier for Java), along with Type hints, that is inferred type where it’s not explicitly set.
Groovy 2.5.0 support
VCS: reverting and rewording commits, formatting commit messages
- Windows 10 native look and feel
- Better HiDPI support for multiple display setup on Windows
- Automatic font settings adjustment to match display resolution
- Editor: Parameter hints and Type info
- Formatting: Rearrange Code
- Refactorings: Move (across ES6 modules)
- Frameworks: better support for React and AngularJS
- CSS Modules support
- Better Webpack support
- Code coverage for Mocha
- Arbitrary modules can now be marked as Unloaded to conserve CPU and memory resources when working on large projects.
- You can suspend indexing and resume it at your convenience.
Did anyone say Java 9?
Trisha Gee, Developer Advocate at JetBrains explained in a blog post that many improvements in IntelliJ IDEA 2017.2 are to support the Java Platform Module System. According to Trisha, one of the new features to help developers getting up to speed with Jigsaw and Java modularity is the new Java Module Diagram.
This video shows the new features to support Java 9 development in IntelliJ IDEA 2017.2.
“If you are working with Java 9 modules, you’ll see code completion and generation has been improved for the module-info.java file,” Trisha wrote. Errors and warnings, as well as their suggested fixes have also been improved.
Allowing you to create your own modules is not Project Jigsaw’s only impact: the visibility of packages is also impacted by modularity, which means that classes that were previously accessible may not be anymore (including reflection). IntelliJ IDEA’s inspections can help locate reflection code that tries to access modules which are not on the module path and offers suggestions to fix the problem.
Furthermore, there are a few new inspections to help migrate code to Java 9. The first one highlights module-info files which require automatic modules. Trisha explained that even though automatic modules are useful during migration to Java 9, over time code should be migrated to use true modules. By default, this only highlights transitive dependencies, as this means your code is exposing automatic modules to other modules.
The second inspection points out places where we can use the new Collections Factory Methods. The third one helps us make use of new Java 9 features. For example, if your code has
while loops that wait for a particular value to change, they can be updated to add the new
onSpinWait hint, thus allowing the runtime to potentially optimize this operation.
Last but not least, IntelliJ IDEA is ready for the updates to Javadoc in Java 9. Generated Javadoc is now searchable, thus allowing developers to search for classes, methods or keywords in the documentation. To make the most use of this, Trisha encourages you to add an index tag to your documentation to provide keywords to the search.
For more details about the most important features, check out the What’s New page.