What’s new with IntelliJ’s enlightened, Java 8 supporting IDE
Andrey Chepstov gives us the full story behind the Java 8 compatible IDE, IntelliJ IDEA.
In this interview Andrey Cheptsov gives us a bird’s eye view of IntelliJ IDEA support in Java 8, talks about the overall impact of Java 8 on the industry, and the challenges faced in getting this updated IntelliJ’s update aligned with Oracle’s long awaited platform drop.
JAX: IntelliJ IDEA 13.1 supports Java 8. What exactly does this support consist of?
Cheptsov: As IntelliJ IDEA is about coding assistance first and foremost, the support consists of things such as code highlighting, inspections, code completion, refactorings, formatter, etc. For example, inspections help you spot code which could potentially be migrated to the new API. The IDE also offers quick-fixes that apply the corresponding changes automatically for you.
For instance, the inspections added in v13.1 can help replace usage of loops in your project with the new Java 8’s Stream API. The code completion is also aware of Java 8 specifics and suggests expected lambda expression or method reference. Navigation, in its turn, lets you jump to the corresponding functional interface. We’ve also updated our static @Nullable/@NotNull analysis to support the type annotations (JSR 308).
NetBeans and Eclipse also rolled out Java 8 support to coincide with Oracle’s launch. How does IntelliJ IDEA 13.1 compare to the latest iterations of these two rival IDEs?
All three IDEs provide code highlighting for the new Java 8 constructs, and provide basic help with migration of anonymous classes to lambda expressions. IntelliJ IDEA goes a bit further than the others by offering additional assistance, e.g. replacement of anonymous classes (or lambda expressions) with method references (and vice versa) and replacement of for loops with the new Stream API.
As for the compact profiles already supported by NetBeans, IntelliJ IDEA is only planning to roll this out in one of the nearest updates.
What was the biggest challenge for you IDE developers in implementing the Java 8 support?
There was some lack of specifications at the early stages (IntelliJ IDEA 12 released in 2012 already had support for Java 8 preview). We are very grateful to Oracle developers for their help in answering our questions.
JavaFX 8 is part of JDK 8. What does the JavaFX support look like in IntelliJ IDEA? Are there any plans to provide a deeper integration of the FXML Scene Builder?
The current JavaFX support primarily consists of error highlighting, inspection and intentions available for FXML and CSS files. The IDE also lets you safely apply refactoring across Java and FXML or CSS code: renaming controller from Java updates FXML code, renaming controller’s field updates CSS, etc. JavaFX packaging is provided on top of our artifacts concept.
As for SceneBuilder, it’s seamlessly integrated into the editor now if you’re running IntelliJ IDEA under JRE 1.8. There are still a number of minor issues with Swing/JavaFX interoperability (mostly in drag’n’drop area and performance), but the Oracle helps us fix that.
On the subject of Java 8: What impact do you personally think that the release will have on the industry?
Java 8 is the second release after a long no-release phase, and it was shipped on time. The tooling was updated by the release date. All of this gives us an optimistic feeling that the release cycle is becoming more regular, and we can expect spending less time on further tooling updates (unlike what we did for the Java 7 release).
The new Java 8 language features (namely, lambda expressions), are of course going to have a massive impact on the entire Java ecosystem, especially on the way how people author class libraries.
Everyone on the IntelliJ IDEA team is excited about Java 8 and we’re actually planning to migrate once some of the JDK8-related problems (battery drain, font rendering, etc) are resolved, which, we hope, will happen before the end of this year.
IDEA 13.1 has other interesting features, for example “postfix code completion.” Can you give an example of how this feature works?
When implementing this feature we didn’t expect to get so much attention, but people are really excited about it, and that’s great. Originally the concept came from the ReSharper team (another JetBrains productivity tool for .NET developers). The idea of postfix completion is to reduce backward caret jumps as you write your code. It lets you transform an already typed expression into another one based on the postfix you added. For example, the ‘.if’ postfix applied to a boolean expression wraps it with an if statement. Likewise, ‘.notnull’ triggers a surround template checking the expression for the null value.
What’s coming next in IntelliJ IDEA?
Right now it’s too early for us to announce anything, we’re just approaching the planning phase for the next version. It will definitely bring more goodies for Java developers, especially those interested in raising their productivity. For anyone eager to know what we’re cooking, we recommend checking out our blog where we discuss new and yet-unreleased features, as well as joining the Early Preview Program once it opens later this year.