Torgersen, Mads1; Hansen, Christian Plesner2; Ernst, Erik4; von der Ahé, Peter2; Bracha, Gilad2; Gafter, Neal M.2
1 Department of Computer Science, Faculty of Science, Aarhus University, Aarhus University2 unknown3 Department of Computer Science, Science and Technology, Aarhus University4 Department of Computer Science, Science and Technology, Aarhus University
This paper describes wildcards, a new language construct designed to increase the flexibility of object-oriented type systems with parameterized classes. Based on the notion of use-site variance, wildcards provide type safe abstraction over different instantiations of parameterized classes, by using â€˜?â€™ to denote unspecified type arguments. Thus they essentially unify the distinct families of classes that parametric polymorphism introduces. Wildcards are implemented as part of the addition of generics to the JavaTM programming language, and is thus deployed world-wide as part of the reference implementation of the Java compiler javac available from Sun Microsystems, Inc. By providing a richer type system, wildcards allow for an improved type inference scheme for polymorphic method calls. Moreover, by means of a novel notion of wildcard capture, polymorphic methods can be used to give symbolic names to unspecified types, in a manner similar to the â€œopenâ€� construct known from existential types. Wildcards show up in numerous places in the Java Platform APIs of the newest release, and some of the examples in this paper are taken from these APIs.
Journal of Object Technology, 2004, Vol 3, Issue 11, p. 97-116