It would not make sense to have type inference in a true non-gen environment, because otherwise you and the compiler already know the type and should not interfere with the compiler in anything. However, the closure example I could find is Target Types . From the documents
Take a method declared like this
void processStringList(List<String> stringList) {
And you call it with
processStringList(Collections.emptyList());
Since Collections.emptyList() returns a List<Object , if no target is specified, it throws an error
List<Object> cannot be converted to List<String>
Here, the compiler cannot interfere with the type arguments for List<> . You must explicitly specify the target type, e.g.
processStringList(Collections.<String>emptyList());
However, with JDK 8, this is no longer necessary. Oracle docs Type Inference
This is no longer required in Java SE 8. The concept of what type of destination has been extended to include method arguments, such as the processStringList method argument. In this case, processStringList requires an argument of type List. The Collections.emptyList method returns a List value, therefore, using the target List type, the compiler reports that the argument of type T is String. Thus, in Java SE 8, the following statement compiles:
So, in the last example, the compiler intervenes in the type argument to get the List<String> from Collections.emptyList() .