Java 10 interview series — Part 1

11 experts weigh in: Local-Variable Type Inference is the biggest new feature in Java 10

Gabriela Motroc
Java 10

© Shutterstock / sergign

Java 10 is here — it may or may not have a lot to offer [it’s up to you to decide] but one thing is certain: it is “the fastest release of Java in its 23-year history.” In the first part of this interview series dedicated to the newest Java release, we talked with 11 Java experts about their favorite feature(s).

“Java 10 is more than a simple stability and performance fixes over Java 9”

Despite the fact that Java 9 was released (only!) six months ago, which means the expectations for Java 10 might not have been too high, this release might impress you. Why? Because as Simon Ritter wrote in a recent article, there are a lot of new features in it.

Speaking of features, what’s your favorite? Marcus Biel made a poll on Twitter to find out which features his followers prefer. As it turns out, people are really excited about Local-variable type inference (JEP 286), which enhances the Java language to extend type inference to declarations of local variables with initializers.

Our 11 Java experts feel the same — as Nicolai Parlog explains in one of this answers, “if widely adopted, it will change the way Java code looks even more profoundly than lambda expressions did.”

SEE ALSO: Java 10 is here!


11 answers: Java 9 was highly anticipated — not necessarily because it was delayed, but because of Project Jigsaw. If we go further back, Java 8 had lambda expressions and so on and so forth. What’s special about Java 10?

Meet our Java experts

Donald Smith is Senior Director of Product Management at Oracle.

Greg Luck is CEO/CTO at Hazelcast.

Simon Ritter is the Deputy CTO of Azul Systems.

Lukas Eder is the founder and head of R&D at Data Geekery GmbH, the company behind jOOQ and a Java Champion.

Trisha Gee is a Developer Advocate at JetBrains, a key member of the London Java Community and a Java Champion.

Markus Eisele is the Head of Developer Advocacy at Lightbend and a Java Champion.

Marcus Biel is a Software Craftsman, JCP member and CleanCode Evangelist.

Dr. Wayne Citrin is CTO and cofounder of JNBridge, LLC.

David Heffelfinger is a Java Champion and a Jakarta EE consultant and instructor.

Nicolai Parlog is a developer (mostly #Java), blogger at CodeFX, author, YouTuber, trainer.

Richard Gall is Communications Manager at Packt.

Donald Smith: What’s special about Java 10 is that it’s the first release of the new six-month cadence announced back in 2017.  It’s proof that time-based release trains can work for Java SE. Moreover, this release is more than a simple stability and performance fixes over Java 9: it introduces new features like local variable types and parallel GC for G1. It also demonstrates the ability to include experimental features such as a Java-based JIT compiler and features that were previously closed-source-only like Application Class-Data Sharing.

Java 10 is the fastest release of Java in its 23-year history.

Greg Luck: There are not really any big features here. It is an orderly maintenance release. It could just as easily have been called Java 9 update 1.

Simon Ritter: JDK 10 is the first release that uses the new six-month cadence.  The impact of this is that JDK 10 only contains features that were ready in that timescale.  

The special thing about JDK 10 is that it’s the fastest release of Java in its 23-year history.

Lukas Eder: Java 10 really isn’t that special. The new release cycle changed quite a few things, such that Java 9 and Java 10 aren’t LTS (Long Term Support) releases. Few people will actually upgrade to these releases.

But it’s good that Oracle can push new features out there to get early adopter feedback.

Trisha Gee: Probably how soon it’s coming out! Just 6 months after Java 9 we’re getting an update to the language, and one that contains some updates to syntax that will simplify the way developers work.

Markus Eisele: First of all, it is the first release in the new six-month cadence. Seeing it successfully delivered will add a lot more trust to reproducible builds and future releases. And it also comes with a lot of additional support for Docker which is something many have been waiting for.

Marcus Biel: Java 10 is the first release of the new semi-annual release cycle. This in itself is an important step in the right direction. JEP 286, Local-Variable Type Inference, is the only real developer feature. For me as a Clean Coder, this “compiler magic” is potentially more dangerous than helpful. As my friend Heinz Kabutz pointed out in issue 255 of his newsletter, it may get us into trouble when we call methods of a certain implementation on a reference variable of an inferred type.

Wayne Citrin: Not much. From the point of view of most developers, the biggest new feature is the local-variable type inference. Call me old-school, but I find code easier to read when variable declarations include the type, and I also have no problems supplying types when I declare variables, so I probably won’t use this feature. But I recognize that a lot of people will use it, just as it’s already a popular feature of C#.

David Heffelfinger: Java 10’s major feature is local variable type inference since we won’t have to declare the type of local variables if the compiler can infer it from the code, for example, instead of declaring a list of integers as:

List foo = new ArrayList();

We will be able to declare our variable as:

var foo = new ArrayList();

However, the main “feature” of Java 10 is not a feature at all, but the fact that it is the first Java release after the new 6-month release cadence was established.

Nicolai Parlog: Java 10 is interesting in that regard. Java 8’s lambda expression required quite a lot of engineering time and had a big impact on the look of Java code. Java 9 took even longer, but code will look pretty much the same.

Java 10 comes with local variable type inference, i.e. the var keyword, which, compared to lambdas and the module system, is a pretty straightforward feature. In essence, it’s “just a small change in the compiler”. But if widely adopted, it will change the way Java code looks even more profoundly than lambda expressions did. Let’s see whether that will be the case.

Richard Gall: Java 10 has the var keyword.


Describe your favorite Java 10 feature.

Donald Smith: I will channel my inner Dr. Deprecator and say my favorite features are those that slim down the JDK.  Therefore, I like JEP 313, removal of the javah tool.

Greg Luck: Local Variable Type Inference (though it does not have a lot of competitors): it’s a feature all Scala lovers will appreciate the most since it allows to skip the type declaration for local variables and loops.

var map = new HashMap<String, String>();

The functionality is, however, limited only to local variables and for-loop indexes.

JEP 286 —Local-Variable Type Inference— is the only real developer feature.

Simon Ritter: It would have to be local variable type inference. It’s a small change that allows developers to reduce the amount of boilerplate code they write and let the compiler figure out what type a variable is.  

It turns out there’s a couple of unusual edge cases that mean you can do things you couldn’t do before, which is cool. It also means that you can no longer define a class called var (not that you ever should have).

Lukas Eder: The only thing that I find interesting is JEP 286 – Local-Variable Type Inference. This will greatly help jOOQ users, as they can infer all the generics that jOOQ produces. I’ve blogged about this here.

Trisha Gee: Local-Variable Type Inference (JEP 286) is the most interesting feature in Java 10 to me.  This is the ability to say:

var myList = new ArrayList();

instead of

List myList = new ArrayList();

It seems like a small thing, but it reduces quite a lot of duplication of text (e.g. “List” on either side of the equals sign), removing boilerplate and bringing Java syntax a little closer to some of the other JVM languages who’ve already adopted this approach.  

I’ve been playing with this new feature in Java (as well as being familiar with similar syntax in Groovy and Kotlin) and while it’s not a big new way of programming the way lambda expressions were, it’s a nice addition to the language.

Markus Eisele: I like the new APIs for the creation of unmodifiable collections. The List.copyOf, Set.copyOf, and Map.copyOf methods create new collection instances from existing instances. And of course the improvements for running in Docker. It’s hard to judge about the 109 changes in total.

Marcus Biel: Not an easy question. None of the twelve JEPs in any case. JEP 307, Parallel Full GC for G1, is nice, but to be honest, Garbage Collection isn’t exactly my strongest passion. If anything, maybe some of the additions to the standard class libraries. For example, List, Map and Set get a new static method, copyOf(Collection), which will return an unmodifiable List, Map or Set, containing the elements of the given Collection.

Anyway, I passed over that question as a poll to my Twitter followers, with the following result:

52.7% 286: Local-Variable Type Inference

14.5%  307: Parallel Full GC for G1

7.3% 317: Experimental Java-Based JIT Compiler

5.5% 310: Application Class-Data Sharing

4.8% 312: Thread-Local Handshakes

4.2% 304: Garbage-Collector Interface

3.6% 316: Heap Allocation on Alternative Memory Devices

3% 322: Time-Based Release Versioning

2.4% 319: Root Certificates

1.8% 296: Consolidate the JDK Forest into a Single Repository

0% 313: Remove the Native-Header Generation Tool (javah)

0%  314: Additional Unicode Language-Tag Extensions

Wayne Citrin: I don’t really have one. I suppose the type inference is the most interesting to me, but I don’t plan to use it.

David Heffelfinger: Java 10 is a minor release and therefore does not contain any major features, the only “user-facing” feature is local variable type inference, which I think it is nice to have.

Nicolai Parlog: I recently experimented with Application Class Data Sharing, which I found quite interesting. Still, I have to say var just because it has so much potential (good and bad). Beyond its intended use case, there’s a lot of shenanigans you can do with it — check out this post from Benji Weber for some inspiration.

Richard Gall: Any other feature (apart from var ) is not really important for the average programmers.


In the second part of our interview series (four more to come), we asked our interviewees to talk about the biggest misconceptions about Java 10 and the features they would have liked to see but were not included. 

Gabriela Motroc
Gabriela Motroc is editor of and JAX Magazine. Before working at Software & Support Media Group, she studied International Communication Management at the Hague University of Applied Sciences.

Leave a Reply

1 Comment on "11 experts weigh in: Local-Variable Type Inference is the biggest new feature in Java 10"

Notify of

I can’t see how local-variable type inference is a good thing as we lose so much when it comes to readability. The good thing is we won’t be forced to use it