Javac Throws "error: incompatible types: cannot infer type-variable(s)" with Valid Inferences

(Doc ID 2171428.1)

Last updated on AUGUST 14, 2016

Applies to:

Java SE JDK and JRE - Version 8 to 8
Information in this document applies to any platform.

Symptoms

The Java SE 8 javac compiler rejects code which should compile due to a type inference problem.

Consider the following code sample:



Changes

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms