My Oracle Support Banner

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

Last updated on MARCH 31, 2023

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.

Disclaimer:

This sample code is provided for educational purposes only. It is not supported by Oracle Support. It has been tested internally, however we do not guarantee that it will work for you. Ensure that you run it in a safe test environment. Additionally, the code and object names used in this article represent fictitious sample names that make up an example. Any similarity to actual code is purely coincidental and not intended in any other manner.

Consider the following code sample:



Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

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


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.