How IntelliJ IDEA Enhances Java 11: New Lambda var Support and Migration Tips
This article explains how IntelliJ IDEA supports Java 11 features such as lambda parameter var syntax, highlights removed APIs, and offers practical guidance for migrating code from Java 9 and 10 while showcasing IDE tools that simplify the transition.
IntelliJ IDEA now fully supports the newly released Java 11, offering developers convenient features to adopt the language's updates.
Java 11 Highlights
Among the new language features, JEP 323 introduces the ability to use var for lambda parameter types, allowing shorter and clearer code. For example, a traditional lambda declaration looks like:
BiConsumer<Processor, String> consumer1 = (Processor x, String y) -> x.process(y);IntelliJ IDEA can automatically remove the explicit parameter types, simplifying the expression.
When annotations are needed on parameters, Java 11 lets developers replace the types with var:
BiConsumer<Processor, String> consumer = (@NotNull Processor x, @Nullable String y) -> x.process(y);IDEA can transform this to use var without warnings, as shown in the accompanying screenshots.
API Changes in Java 11
Beyond language syntax, Java 11 removes several modules such as Java EE and CORBA. Developers must add explicit dependencies for formerly built‑in APIs like JAXB, which are no longer part of the core runtime.
Java 10 Recap
Java 10 introduced var for local variable type inference. IntelliJ IDEA assists by offering quick‑fix actions to replace explicit types with var, navigation shortcuts (Ctrl/⌘ + Click), and documentation pop‑ups (Ctrl + Q / F1).
Java 9 Overview
Java 9 brought module system (Project Jigsaw) and many convenience factory methods. IntelliJ IDEA provides code inspections that suggest migrations to these new APIs.
Migration Recommendations
To adopt Java 11 smoothly, ensure all project dependencies are up‑to‑date, especially those previously provided by Java EE or CORBA. Updating libraries while minimizing impact on existing code is essential. IntelliJ IDEA simplifies this process with refactoring tools and inspections.
Developers can download the OpenJDK 11 build (or Oracle’s distribution) and start using the new features immediately.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
