Java 10 Released

| by Ben Evans Follow 17 Followers on Mar 21, 2018. Estimated reading time: 2 minutes |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

Oracle has released a new version of Java - Java 10. This release comes just six months after the release of Java 9 and like the previous release, it is another feature release with a lifespan of only six months.

The release of Java 10 immediately obsoletes Java 9 and no further free support releases of Java 9 will be made available. As of March 20th, the only versions of Java with free support from Oracle are Java 8 and Java 10. The next release with long-term support available is Java 11, which will be released in September 2018.

The final release is virtually unchanged from the RC1 candidate and no significant features have been added since InfoQ first reported on the release contents in November 2017.

Full documentation of this release is available as well as release notes for the language-level changes in this version.

For the developer, one major language feature is the arrival of var. This is an enhancement to Java's type inference capabilities that may prove to be more significant than it first appears. In the simplest case var allows code such as:

var foo = new ArrayList<String>();

which moves the inference from the type of values to the variable.

The implementation in Java 10 achieves this by making var a reserved type name rather than a keyword. This means that code that uses var as a variable, method or package name is not affected.

As well as the simple cases, this actually permits programming constructs that were not possible before. For example, javac has always permitted a very limited form of type inference:

public class Test {
    public static void main(String[] args) {
        (new Object() {
            public void bar() {

and this edge case has been known in the Java community since before the arrival of Java 7.

The problem with this form of type inference is that it has no real practical applications - the type of "Object-with-a-bar-method" exists within the compiler, but the type is impossible to express as the type of a variable - it is not a denotable type.

With the arrival of Java 10, the type of variables does not need to be made explicit, and instead var can allow us to preserve the static type information by avoiding denoting the type. This means we can now modify our example and write:

var o = new Object() {
    public void bar() {

This use of var as a "magic type" allows the programmer to preserve type information for each distinct usage of type inference in a way that is somewhat reminiscent of type constraints from Java's generics.

More advanced usages of var with non-denotable types are possible, and while the feature is not able to satisfy every criticism of Java's type system, it does represent a definite (if cautious) step forwards.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Java 10 by Serge Bureau

How pathetic, so little change. Forget Java

Re: Java 10 by Ben Evans

You're entitled to your opinion.

I might argue that producing a new major release that contains the changes listed here - all of which, except for LVTI, impact all JVM languages not just Java - in 6 months is pretty solid engineering work for a 20-year old production grade language that treats backwards compatibility as a first-class concern.

Re: Java 10 by Cameron Purdy

Serge, considering how much you are paying for Java, I think you got way more than you deserved. For once, don't be such a prick.

* The Java team communicated how they are going to do releases.
* The Java team suggested what might show up in upcoming releases.
* The Java team did that work in the public, where you can see it (or for that matter, where you could help, if you wanted to spend your energy in a positive fashion).
* The Java team explained that they weren't going to push features into releases until those features were well baked, tested, vetted, etc., and they kept their word.

Frankly, I find it quite encouraging that the communication has been consistent, straight-forward, and relatively complete, and that the actions that we see are consistent with that communication. I can't imagine a more positive scenario.

As for why they haven't cured cancer and created flying unicorns with this latest release, that's a more complicated question. The budget for the Java team at Oracle has been repeatedly cut, even though it is a healthy source of profit. Frankly, it's a miracle that Oracle's executive mismanagement hasn't managed to kill Java.

The ability for that team to deliver any improvements without breaking lots of applications is laudable. The fact that they've rebuilt significant internal parts of Java over the past decade without breaking everything is astounding. Whatever they're doing, they need to keep doing that.

As for you, get off your butt and pitch in if there's something that you think needs to be improved. There's a reason why it's called OpenJDK.



Re: Java 10 by Serge Bureau

Java is the best proof that backward compatibility at all cost is a mistake

Re: Java 10 by Serge Bureau

The price I pay is the stagnation of progress, it is also the extra cost customers pay for a bloated language (which by the way is very inconsistent)

I found your work inspiring for years, but you are losing me here.

Java 10 by b tra

The Java 10 var new feature is just the top of the iceberg. More than 5,000 issues/ enhancements have been addressed to improve startup, Docker support, memory footprint, G1, JIT compilation, efficiency, performance, etc.. under the cover. JDK 9 developers should absolutely uptake 10, and 11 EA builds ( are already available :-)


Jetbrains - kotlin the saviour of java, the language by Antonel Ernest Pazargic


IMHO It could be a better decision to let Jetbrains to drive the java evolution with kotlin.

Re: Java 10 by Ben Evans

The world of software development is very large, and getting larger. No one language has the right answers for everything across every domain. Java wears its design principles clearly upon its sleeve - "backwards compatible, conservative and cautious when making changes, accessible for beginners, readable and possible to deploy and reason about at scale".

You may not like them, but that probably only indicates that it's not for you. There are plenty of other languages where you may find your own requirements better met. They will probably not do as well in the niches where Java is well adapted.

In the specific case of backwards compatability - how many language features has C++ ever successfully removed? Or even the "move fast and break things" kitchen sink languages like Scala? Why is default version of Python still Python 2 after so many years? Why does basically every Scala library need recompiling at every version, often even at point releases (or even patch levels in some cases)?

The truth is that backwards compatability and avoiding / reducing regressions or breakage is not at all easy and requires serious effort on the part of language / library maintainers, and those who feel responsibility to their users.

Re: Java 10 by Serge Bureau

Sorry to disagree, there is a language that answer to every domain, it is Scala. Get over it

Re: Java 10 by Cameron Purdy

Sorry to disagree, there is a language that answer to every domain, it is Scala.

See? Everyone's happy!

Re: Java 10 by Serge Bureau

"""The truth is that backwards compatability and avoiding / reducing regressions or breakage is not at all easy and requires serious effort on the part of language / library maintainers, and those who feel responsibility to their users."""

I understand that making all you can to avoid progress is a lot of work, we agree.

Compiled for other platforms? by Steve Zara

I have been staying with Java 8 because the Oracle releases for Java 9 don't include Linux ARM. The Java 10 release has come while there is still no Linux ARM version of Java 9. Am I missing something? Are there other sources of Java for ARM?

Re: Compiled for other platforms? by Ben Evans

There are a number of OpenJDK vendors that are shipping Linux ARM binaries, I believe.

I haven't been following closely, but if I recall correctly, there are ongoing efforts around the JIT on ARM which may mean that it is not fully considered a complete platform yet.

Re: Java 10 by Ben Evans

Backwards compatibility is a huge deal to many enterprises and the folk who actually, y'know, write the cheques that pay for the development of platforms that the majority free-ride upon.

If you don't like the emphasis that OpenJDK developers place on stability and backwards compatability you are at liberty to go and create your own language runtime, or have fun with compiling to Javascript as a "backend".

If "progress" (however you're defining that rather nebulous term) is what matters to you, why aren't you off enhancing and working with the languages that share your priorities, rather than bothering with communities that emphatically don't?

Re: Compiled for other platforms? by Steve Zara

Java 8 implementations from Oracle on ARM seem full-featured and high-performance, so there is a complete platform for Java 8. However, I will look at OpenJDK versions for Java 8. Thanks for the suggestion.

Re: Java 10 by Serge Bureau

They are making billions of profits so do not worry for them.
I am bothering you because I am fed up to use 20 years behind technology promoted by business that know nothing about technology .
Free ride you say ? I on the contrary think we paid it dearly.
For you maybe progress is a nebulous term, not for me.
People you encourage wrote the pay system for Canada government (IBM), they paid a billion,it still does not work, they are now offering to write it anew, yes give those people another billion to try to fix their mess. Must be written in Java with high backward compatibility. They are crooks. You are free to continue ignoring the mediocrity written everyday.

Re: Java 10 by Ben Evans

If you want to improve things along the axes you deem important and make the platforms that you want to see, you know where to contribute. What you choose to do is up to you.

This is my final comment on this thread.

var is a bug by Michael McCutcheon

can I do this with var?

var x = y();

If so, it sucks. Hiding the type information doesn't make anything easier to read.

Having to hover over x in my IDE to see what the type is is easier to simply have the type in the code, not a mouse-over. Anyone who argues that a mouse-over is easier to read is nuts...does anyone here seriously believe that having to use tools to see the type is easier than just reading it in the code?

var stream = getStream();

Without using tools, can you tell me what type does getStream() return? A Stream<String> or a LoggingStreamContainer or a PhysicsModeledWaterStream?

Additionally, what is a person to do if they are looking at the code in github? Does var make it easier or harder to see the type?

This is a terrible 'feature' that should be removed from Java 11 before too many people start using it.

Say new version? by John Smith

Smiling comments while using Java 6. Java has robust platform features like reliability, consistency, backward compatibility etc. Looking creepy language features, go other langs. New version policy may result some immature versions which I didn't like.

Re: Java 10 by Javier Paniza

Sorry to disagree, there is a language that answer to every domain, it is Scala. Get over it

Java tags in StackOverflow: 1 390 865
Scala tags in StackOverflow: 77 113

So, there are two type of languages: ones that everybody criticize (like Java) and ones that nobody use (like Scala).

Re: var is a bug by Michael Redlich

Hi Mike:

What you say is absolutely correct. It is a good practice to use better variable names when using var. You're not the first person to bring up this issue. Just check out the "readability" section of:

The more important thing to understand is that the use of var for *local* type inference. That is, var may only be used in:

* local variables with initializers
* for-loop indices
* the local scope of a conditional loop.

var may NOT be used in parameter lists and return types.

I understand that local type inference may not be popular, but it's here in the language now. If you rethink the paradigm, maybe one day, you will find it useful.


Re: Java 10 by Serge Bureau

You are right, there are 2 types of languages, ones that generates boring jobs, and ones that motivates you more everyday

Re: Java 10 by Victor Grazi

Java should be your first choice for building robust, enterprise ready server side applications that will endure (i.e. just about every enterprise application.) It is evolving fast, it is highly supported and community maintained, it has passed the test of time (or should I say the unit tests), and you have full confidence that the next version is just going to work! Other great choices are Python and Kotlin. But it depends on your use case. Scala? Yeah, that's a good language, but not enough to start a flame war, which appears to be your goal.

Re: Java 10 by Serge Bureau

Evolving fast you said, you must be kidding ! Python, talk about a ridiculous choice, totally unsafe.Kotlin, barely better than Java.
A flame war against incompetence is really needed.
My goal is to wake as much people as possible from mediocre languages

Re: Java 10 by Victor Grazi

Ok, well I question the efficacy of your strategy. I would advise you to find a language that better suits your goals, and use your talents to contribute there. In any case, unless you have anything significant to add, I don't think I can add anything further that has not already been said.

I'm personally happy... but! by Richard Richter

I downloaded JDK 10 and started my Spring Boot application just to find out that naive upgrade (from now not supported Java 9) caused that annotated JPA entities were not found (EclipseLink). So I have to find some time to figure it out, because in short lists there is no hint (did the reflection get more strict even if I used classpath? I don't know yet...).
But in overall I'm looking forward to faster release cycle.

Re: var is a bug by Pavel Grushetzky

can I do this with var?

var x = y();

You don't need java 10 to do this. Prior java versions fully support
Object x = y();

doing either is a questionable idea though.

Re: var is a bug by Michael McCutcheon

I understand you can do stupid things in earlier versions of Java, but now it's actually being encouraged. Advocates of var think this is easier to understand:

var userDB = broker.findUserDB();


UserModelHandle userDB = broker.findUserDB();

They feel that hiding the type and having to mouse over it to 'find' it is better than just reading it.

They are batsh*t crazy, they are wrong. I don't even know how there is a debate about the above code. Anyone that says that it's easier to see the type in the first example is nuts.

You still have to READ what the type is, it's just with 'var' there is the extra step of having to mouse-over it to be able to read it. If you're looking at code on github, forget it.

The 'var feature' should only be enabled by an obscure compiler flag, depreciated, and eventually removed.

Re: Java 10 by Nick C

Sorry to disagree, there is a language that answer to every domain, it is Scala. Get over it

This has to be one of the most moronic comments I've seen on infoq. I'd been happy believing that infoq was troll appears not.

Re: Java 10 by Javier Paniza

ones that generates boring jobs

but what is the goal of the software? The pleasure of the programmer or the pleasure of the user? Many times egoist developers only thinking in programming languages and frameworks make the user life misserable.

Re: var is a bug by Kyle Smith

But programming is all about context; context of the programmer (are they reading or writing code) and context of the code (what is this code doing). It doesn't make sense to post an individual line of code as proof that using var is "batsh*t crazy" as nobody would code like that.

public void findBrokeredUserDB() {
UserModelHandle userDB = broker.findUserDB();
I'm sorry but this isn't any more or less clear with var since it's still missing context. I'd first ask why return anything from findUserDB if you're not going do anything with it. What is broker anyways? I'll have to go search for that if just I'm reading it off of github. There's so much context missing that UserModelHandle doesn't help me.

public UserModelHandle findBrokeredUserDB() {
var broker = brokerFactory.create<UserDBBroker>();
var userDB = broker.findUserDB();
return userDB;
I question whether the use of var in this method renders the code more or less legible. There are still questions (like what is brokerFactory) if I'm reading a static file from notepad++ but knowing brokerFactory is a BrokerFactory type doesn't really help me as I still need to go look for it. I'm going to be looking at the context of the file as a whole anyways so somewhere in there I'm going to see a final BrokerFactory brokerFactory = new BrokerFactory() or something like it that explains the context. Consider if this was just a verifyUserDB() method that didn't return anything and only called the verifyModel method. You wouldn't know just by reading it that it was use a UserModelHandle class, but then again would you care? Reading the code as a whole, you'd already be looking into what UserDBBroker did and that source would show you UserModelHandle.

Writing code is a different context all together. You'll need to know what all these classes do and how they work together and what methods return (the joy of programming, amiright?). If you are asked to code against an API you'd already be reading documentation about what is returned and what those returned objects do. All this context is what adds up to whether lines of code are clear or not.

Now if you run across something that's smattered with code like this:
var x = y();
var r = x.z();

... well any code you find online that looks like that should be seriously questioned regardless of the returned types.</userdbbroker>

Re: Java 10 by Serge Bureau

I already found

Re: Java 10 by Serge Bureau

You just activated my « dumb » detector. Please prove me wrong

Re: Java 10 by Serge Bureau

So why are you using Java. It is bad on both account !

Re: var is a bug by Ali Cheaito

@Pavel Grushetzky - Java wouldn't infer the type in that case. Consider a Person class with public method getFirstName(). The following code would not compile:

Object x = new Person();

This is because x is instantiated as an object of type Object and requires a type case to call methods of Person.
On the other hand, this works just fine with Java 10:

var x = new Person();

The reason being that x is an object of type Person, as inferred by the java compiler.

Re: var is a bug by Pierre-Luc Maheu

Similar forms of type inference exist in other languages. In C#, for example, similar concerns were expressed when the feature was added a couple years ago. Since then practice has demonstrated, at least for C#, that inferring the type makes the code more concise without loosing much. Turns out the type is not that important for readability as long as variables have meaningful names.

Re: var is a bug by Michael McCutcheon

But that's just're assuming that developers are going to use meaningful names.

Having to embed the type information in the variable name is a bad hack and good luck with getting everyone to do it consistently.

Re: var is a bug by Pierre-Luc Maheu

Embedding type information is not what I meant by "meaningful name", that would be Hungarian notation and has been considered bad practice since many years. I'm also not assuming anything, I'm stating what has been observed in languages like C# which had the "var" keyword for years.

Nothing noticeable by Hung Nguyen

Supporting for "var" keyword has already implemented in other languages (added into C# 3.0 from 2007, ). Oracle should do the last good thing for JAVA: giving it to the community or other more innovative company, similar to what they've just done for JAVA EE. Or, Oracle can just re-define "JAVA" is nothing more than just the name of the virtual machine, then accept and support other more innovative language such as Kotlin to become the mainstream language of the platform.

Re: Nothing noticeable by Cameron Purdy

Hung - It's already been "given to the community" ... check out this web site:

If you want to help innovate, go ahead. If you want to complain, then this is the right place.

Re: Nothing noticeable by Hung Nguyen

I mean the JVM and the language itself, not the JDK. And even OpenJDK is still maintained by Oracle engineers. I dream of the day that Java will be bought by another company such as Pivotal or Jetsbrain. Oracle accquired Java in order to sell their application server, but now the world is quickly adapting microservice that gradualy undervalue the heivy application servers so I believe that the day Oracle throw away Java would soon become true. You see, they don’t want to waste more money on maintaining Java EE.

Re: Java 10 by Seriy V

@Serge Bureau Man, don't you have other things to do? Have you tried any other way to improve your self-esteem different from trash talking?

Re: Nothing noticeable by Seriy V

As for me there is problem in your reasoning. You say that Oracle bought Java to sell application servers and at the same time "they don’t want to waste more money on maintaining Java EE". Sorry, but these two statements contradict each other. Without Java EE there are no application servers to sell. So if your reasoning is selling of application servers you want to invest into Java EE.

There is one programming language Pivotal has owned and has evolved. It is called "Groovy". If you don't know this story your are probably new to IT and programming.

Any IT company has to monetize it investments after some time otherwise there will be no investments in future. You have to pay salaries to your engineers. Rad more about Groovy, read more about Typesafe -> Lightbend. There are tons of other examples if you dig a bit.

Re: Nothing noticeable by Seriy V

Why Oracle "should" do something? Do they owe you or me something? I wish they were but they don't. I wish I could tell Oracle what they should do. Really, I wish I could. Some people invested money into some company. Some people have created that company. If you and me haven't do this (neither investment nor development of the company itself) how can we tell them what they should do with their investments?

And speaking about "innovative" languages I have few comments. Each few years there is another new language with the promise to replace Java. First it was Groovy, after that - Scala and now Kotlin. And guess what - after few years there will be something else. Look at the the history of previous "contenders" - Groovy and Scala.

Re: Java 10 by Seriy V

@Serge Bureau
The TIOBE index ( of software language popularity ranked Scala at #13 in 2012; now it’s fallen to #32 in August 2016, being used by less than .6% of the programming community.

And probably this makes you angry and the last thing you have in your arsenal left is "flame war".

Re: Nothing noticeable by Seriy V

Hung, Java is licensed under GPL - the same license Linux kernel uses. Why don't you help to maintain it so that it was not only Oracle?

You (and me) can't just contribute ideas what other people should do. Sorry, but there are thousands of people who are willing to tell what others should do. But they don't want to do the work by themselves. And guess what - different people will have different ideas. So why Oracle should listen you but bot the guy with the opposite point of view? This is not how open source works. Start contributing, make great contribution and your voice will be heard.

Posting comments is easy. Contribution is possible if you want to do this but not just complain in comments.

Re: Java 10 by Serge Bureau

Please, show me where I am wrong.
By the way, being politically correct is so lame

Re: Nothing noticeable by Hung Nguyen

Seriy, you are telling me what I should do :)

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

48 Discuss

Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you