Bringing Java 7 Support to IntelliJ IDEA 10.5
We speak to IntelliJ IDEA senior software developer, Anna Kozlova, about implementing the new Java 7 language features in IntelliJ IDEA 10.5.
Back in February, JetBrains announced that the major focus of
their 10.5 release, would be Java 7 support. In this interview, we
speak to IntelliJ IDEA senior software developer, Anna Kozlova,
to find out more about implementing the new Java 7 language
features in IntelliJ IDEA 10.5.
JAXenter: IntelliJ IDEA 10.5 came with full
Java 7 support. What has been the most challenging Java 7 language
feature to implement in IntelliJ IDEA?
Anna Kozlova: Definitely, the ability to
support String types in switch statements. We even implemented it
as early as IntelliJ IDEA 10, to have more time to polish its
usability. Indeed, the real challenge is to integrate new language
features with the huge number of IntelliJ IDEA’s intentions,
inspections, refactorings and so on. It is not rocket science to
write a lexer or a parser. It is much more important and
time-consuming to get all the existing features updated to match
the change, so that everything still works consistently after the
new features have been added.
JAXenter: For you, what key benefit will Java 7
support bring to the IntelliJ IDEA user?
Anna: IntelliJ IDEA has always been good at
generating and completing complex code fragments for you. Now, with
the new ‘language syntactical sugar,’ even this is not needed
anymore. So, that is the benefit – even less typing, and thus
JAXenter: How have you tried to manage the
learning curve, for developers moving to Java 7 with IntelliJ IDEA
Anna: As always, IntelliJ IDEA provides batch
inspections for an easier transition. For example, it is possible
to run “Explicit type can be replaced with <>” inspection
over the whole project and to apply a simplification fix which will
convert new expressions to use diamonds. Of course, it will convert
only the usages where diamonds are applicable. We’ve also added
other inspections to compactify ‘try/finally’ to ‘try’ with
resources, collapse identical branches into multi-catch try,
JAXenter: Java 7 support has been available in
early access builds of IntelliJ IDEA since March. What were the
challenges of supporting a technology that was still under
Anna: Apart from the fact that we had to rework
some parts… One other situation that we’ve faced recently was a
difference between the specification and the way the Java compiler
works. We decided to follow the compiler because this is what
people will use.
JAXenter: And, looking forward, what are the
plans for Java 8 support in future releases of IntelliJ IDEA?
Anna: It doesn’t take much planning to decide
that all of the features will be fully supported and that we will
provide inspections and refactorings to help introduce the new
features into the codebase, just the same as we did with Java 7 in
IntelliJ IDEA 10.5. As for the specific features and timeframes, it
all depends on how the development of Java 8 itself proceeds.