What does var<T> do in Java?

As it turns out, the usage of var<T> is only allowed in Eclipse with JDT core, javac does not accept this. Therefore, I assume this is a bug in Eclipse.

EDIT: As @MC Emperor showed, this is definitely a bug. I have added this bug to the Eclipse Bugzilla.


This is indeed a bug, but the proof lies in the Java Language Specification § 14.4 Local Variable Declaration Statements:

LocalVariableType:
    UnannType
    var

Ad you can see, the restricted identifier var is listed without any other token. Also, UnannType eventually resolves to the token TypeIdentifier which explicitly forbids var.

So no, var<Integer> is not valid.