Below is a directory of websites and resources related to Java Generics,
a language feature added to the Java programming language with version
5.0 of J2SE. Most of the resources are in English, some in German.
WEBLOG:
Super Type Tokens
A
weblog
by Neil Gafter of Google written on December 4, 2006. There are not
class literals for parameterized types due to type erasure, but sometimes
you wished you had a type representation even for a parameterized type.
Neil's type token is a pretty neat idea for a work-around. See also the
follow-up
.
WEBLOG:
Self types (aka type of this)
A
weblog
by
Peter von der Ahé of Sun Microsystems written on November 16, 2006.
Discusses
Laird Nelson
's case study and shows
an alternative and much simpler design and implementation.
WEBLOG:
I am thoroughly humbled by generics
A
weblog
by Laird Nelson written on October 31, 2006. Another interesting
case study of the design and implementation of a bunch of generic classes
and interface. Illustrates the difficulties (the author even talks
of a "disaster") that programmers tend to encounter when they generously
introduce an abundance of type parameters. See also
Peter
von der Ahé
's alternative approach.
ARTICLE:
Strategy
Pattern with Generics
An
article
by Heinz Kabutz discussing the use of generics for implementation of the
Strategy pattern. An interesting case study that demonstrates some
of the typical difficulties that programmers struggle with when using Java
generics. Published in March 2006. Note also the interesting
counterpart
in C++
written by Radu Braniste in April 2006.
SLIDES:
Effective
Java Reloaded
Joshua Bloch's
presentation
at JavaOne 2006. It has some interesting example of using and abusing Generics.
ARTICLE:
Reflecting
Generics - Generics add type information that classworking tools can use
An
article
by Dennis Sosnoski on use of reflection for retrieval of information about
generic types and methods. Published in November 2005.
INTERVIEW:
Migrating
to Tiger: James Gosling and Mark Reinhold on Java 2 Platform, Standard
Edition 5.0
An
interview
on Java 5.0, whether it's worth migrating to 5.0, what people complain
about and future directions.
COURSE NOTES:
Generics
in Java 5
The
notes
of a course on data structures held at the University of Sussex by Peter
Williams in the summer of 2005. It has a section on Java Generics.
SLIDES:
Programming
With Parameterized Types in Java 5.0
The
slides
of a technical session at JavaOne 2005 given by Angelika Langer in June
2005. Gives an overview of the key features of Java Generics and
discusses typical issues that developers face when they implement a generic
class.
SLIDES:
Generic
Dos and Don'ts
The
slides
of a BOF session at JavaOne 2005 by Janet Koenig, Peter von der Ahé,
and Madhava Avvari of Sun Microsystems in June 2005. Discusses various
pitfalls of Java Generics.
WEBLOG:
Generics
Considered Harmful
A
weblog
by Ken Arnold of Sun Microsystems. Claims provocatively that adding
generics to the Java programming language was a mistake. See also
the
reply
by
Peter von der Ahé.
WEBLOG:
Generic
Wishlist
and Generics Can Force Uncomfortable Design
Two
weblog
entries by David
Hall. Another
wishlist
for further generics features (February 2005) and the discussion of a common
problem
with the
Comparable
interface (May 2005).
ARTICLES:
Good,
bad and ugly of Java Generics
An series of 3
articles
and the slides of a conference presentation by Venkat Subramaniam
in
March 2005. The articles provide another nice tutorial to Java Generics.
ARTICLE:
Generics
gotchas: Identify and avoid some of the pitfalls in learning to use generics
An
article
by Brian Goetz published in his column "Java Theory and Practice" at the
IBM Developer Works site in January 2005.
ARTICLE:
Java
Generics and
Delving further with Java generics
An
article
and a
followup
by John Hunt in January/February 2005. Another introduction to Java Generics.
TUTORIAL:
Introduction
to generic types in JDK 5.0
A
tutorial
by Brian Goetz published at the IBM Developer Work site in Decvember 2004.
WEBLOG:
What Java
Generics Needs
A
weblog
entry by Keith Lea in December 2004. A wishlist for further generics
features.
WEBLOG:
Puzzling
Through Erasure: answer section
A
weblog
entry by Neil Gafter in September 2004. A clarification regarding
the design decision related to type erasure and reification.
ARTICLE:
Case Study:
Converting to Java 1.5 Type-Safe Collections
An
article
by Wes Munsil published in the Journal of Object Technology (
JOT
)
in September 2004.
ARTICLE:
Some Examples
of Generics in Java 1.5 and C# 2.0
An
article
by Richard Wiener published in the Journal of Object Technology (
JOT
)
in September 2004. The author evaluates the code specialization for value
types in C# and the wildcards in Java.
ARTICLE:
Taming
Tiger, Part 2 - Understanding Generics
An
article
by Tarak Modi published in Java World in June 2004. A brief introduction
with a few simple examples.
ARTICLE:
Adding
Wildcards to the Java Programming Language
An
article
by the designers of wildcards (several individuals at the university of
Aarhus and at Sun Microsystems, Inc.) published in the Journal of Object
Technology (
JOT
) in April 2004.
ARTICLE:
Wildcard
Instantiations of Parameterized Types
A series of 2 articles by Klaus Kreft & Angelika Langer published
in May 2004.
Part
1
explains the purpose and use of the wildcards language construct
in Java Generics.
Part
2
covers using wildcard instantiations and looks at some of their limitations.
ARTICLE:
Language
Features of Java Generics
An
article
by Klaus Kreft & Angelika Langer published in March 2004. An introduction
and overview of the major features of Java Generics.
Part
1
discusses parameterized types in general using parameteriezed collections
as an example.
Part
2
covers parameterized methods as well as some aspects of the inner
workings of Java Generics such as translation by type erasure.
ARTICLE:
An Introduction
to Generics in Java
An
article
by John Anthony and Scott Chalfant. published in March 2004. An introduction
and overview of the major features of Java Generics.
LINKS:
Papers describing
new language features in J2SE 5.0.
A
collection of
links
to various papers related to Java generics hosted by Sun Microsystems,
Inc.
SLIDES:
Wildcards
in Generics
The
slides
of a lecture given by Christian Plesner Hansen at the University of Aarhus,
Denmark in February 2004. Explains the reasoning for addition of
wildcards to the language. Excellent background information. Links to further
documents can be found in the
overview
of the course on "Types in Object-Oriented Languages" conducted at the
University of Aarhus.
ARTICLE:
Wildcards
in the Generics Specification
An
article
by William Grosso published in January 2004. An brief, yet excellent explanation
of some aspects of wildcards, more of a motivating example rather than
a comprehensive coverage of the topic.
ARTICLE:
Talking
Tiger, generically speaking
An
introduction
to Java Generics
by Matt Quail published in 2003. Very shallow; has bugs like showing an
immutable pair class that is not immutable. Listed for sake of comprehensiveness
only.
ARTICLE:
Arrays
in Java Generics
A brief
article
by Angelika Langer, that explains a couple of issues in conjuction with
arrays in Java Generics. In particular it shows why arrays of parameterized
types are illegal in Java Generics.
QUIZ:
Java 5.0 Generics
A
quiz
which you can use to test your understanding of Java Generics. It's quite
instructive and fun.
ARTICLE:
Generics,
Erasure, and Bridging
An
article
by William Grosso published in December 2003. Good explanation of the principles
of type erasure and bridge methods.
WEBLOG:
Self-bounding
generics
A
weblog
by Bruce Eckel written in June 2003. Mulls over constructs such as
class
SelfBounded<T extends SelfBounded<T>>
and raises more questions
than it answers. Yet interesting.
CONVERSATION:
New
Language Features for Ease of Development in the Java 2 Platform, Standard
Edition 5.0
A
conversation
led with Joshua Bloch in May 2003 about the new 5.0 anguage features.
ARTICLE:
Java generics
without the pain
A
series
of four articles by Eric Allen published in February-May 2003 at
the IBM Developer Works site.
ARTICLE:
Preparing
for Generics
An
introduction
to Java Generics by Paul Mingardi published in November 2002.
ARTICLE:
Java generics
without the pain
A mini series of
articles
on Java Generics written by Eric Allen hosted by IBM.
PAPERS:
Bibliography
A
directory
of links to articles and papers related to Java Generics. It's the
bibliography of a
paper
in German prepared by Heiko Minning.
ARTICLE:
Generische
Programmierung in Java
An
article
in German by Ulrich Eisenecker und Krzystof Czarnecki.
PAPERS:
Papers by
Philip Wadler
A directory of
articles
on GJ and Pizza by Philip Wadler.
PAPERS:
Papers by
Martin Odersky
A directory of
articles
on GJ, Pizza and other topics such as type systems and functional programming
written by Martin Odersky of Ecole Polytécnique Fédérale
de Lausanne.