Link Details

Link 59149 thumbnail
User 264051 avatar

By bspies
via ajaxonomy.com
Published: Jan 01 2008 / 11:24

A concise overview of the generics implementation in Java 5.0+ that gives some of the advantages and annoyances in using them.
  • 15
  • 2
  • 1455
  • 588

Comments

Add your comment
User 236137 avatar

dzonelurker replied ago:

0 votes Vote down Vote up Reply

"generic type information is erased at runtime--a process referred to as type erasure--when the .class file is compiled."
An expert, obviously.

User 264051 avatar

bspies replied ago:

0 votes Vote down Vote up Reply

The term "type erasure" is used a bit loosely. To some it refers to the removal of generic types (i.e., angle brackets) from the code by the javac compiler (but the generic information is still kept in the class file itself--it's a common misconception that no generic information is available in the class file); to others it refers to the discarding of generic types when the class file is compiled or interpreted at runtime. Neal Gafter himself used it both ways in two different blog entries (9/23/2004 and 11/5/2006). To me erasure is really the discarding of these types at runtime, since this is really at the heart of the majority of complaints about generics.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.