Skip to content

Java Generics and Erasure

February 1, 2012

Generics or the parametrized types are compile time constructs in Java. This means that these do exist in JVM byte code. The process of converting parametrized types to bytecode that is backward compilable with older java code is called Erasure. This can also be called Type Erasure.

Sometimes during compilation, JVM may need to add a bridge method to perform type erasure.

We also need to guard against ambiguity errors that can occur.

Generic exception types are not possible.

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: