Skip to content
Tags

,

JSR335: Type Inference

August 21, 2013

Prior to Java 8, the Java Language Specification only briefly discussed “type inference” in sections 15.12.2.7 and 15.12.2.8. In version 8 of the JLS these two sections will be removed completely and replaced by an entirely new chapter (currently Chapter 18 – Type Inference).

What is Type Inference?

Simply, type inference is compile-time reasoning about unknown types. Type inference is composed of 3 processes that can trigger each other: reduction, incorporation, and resolution. Reduction converts a constraint formula to a set of bounds on inference variables. Incorporation maintains the bound sets and manages the interdependence between inference choices. Finally, resolution determines the instantiation compatible with bounds and the order of inference variables resolution.

Inference variables are meta-variables for types that can be thought of as a single type out of all the possible proper types that can replace the inference variable.

Advertisements

From → Java

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: