Title
The case for run-time types in generic Java
Abstract
Since the advent of the Java Programming Language in 1995, many thoughtful proposals have been made for adding generic types to the Java programming language. Generic types are a glaring omission from the existing language, forcing programmers to use permissive, non-parametric type signatures for fields and methods of "naturally generic" classes (such as java.util.Vector) and repeatedly cast the results of operations on these classes to the more specific types. The JSR14 extension of Java proposed by Sun Microsystems (based on GJ) addresses this problem by adding generic types to the language, but prohibits operations that depend on run-time generic type information. This prohibition relegates generic types to "second-class" status where they are invisible at run-time, which is inconsistent with the status of types including parametric arrray types in the existing language. We have implemented a generalization of JSR14 called NextGen that supports the same syntactic extensions of Java of JSR14 yet eliminates the prohibition on operations that depend on run-time generic type information. In NextGen. generic types are "first-class": they can be used in excactly the same contexts as conventional types. The implementation of NextGen compiler is derived from the same prototype GJ compiler as the JSR14 compiler and shares most of its desirable properties including a high degree of compatibility with legacy code. In this paper, we show through of a series of programming examples that first-class generic types play an important role in writing clean generic code.
Year
DOI
Venue
2002
10.1145/638476.638482
PPPJ/IRE
Field
DocType
ISBN
Scala,Programming language,Java annotation,Computer science,Real time Java,Compiler,Generics in Java,Java Modeling Language,Java,Generic programming
Conference
0901519871
Citations 
PageRank 
References 
8
2.04
4
Authors
2
Name
Order
Citations
PageRank
Eric Allen19410.84
Robert Cartwright252967.27