On the reification of Java wildcards

Maurizio Cimadamore, Mirko Viroli

Science of Computer Programming 73(2-3), pages 59-75, October 2008
Elsevier Science B.V.
Marjan Mernik (eds.)
Selected Papers from the 22th ACM Symposium on Applied Computing (SAC 2007)

Providing runtime information about generic types–that is, reifying generics–is a challenging problem studied in several research papers in the last years. This problem is not tackled in current version of the Java programming language (Java 6), which consequently suffers from serious safety and coherence problems. The quest for finding effective and efficient solutions to this problem is still open, and is further made more complicated by the new mechanism of wildcards introduced in Java J2SE 5.0: its reification aspects are currently unexplored and pose serious semantics and implementation issues.

In this paper, we discuss an implementation support for wildcard types in Java. We first analyse the problem from an abstract viewpoint, discussing the issues that have to be faced in order to extend an existing reification technique so as to support wildcards, namely, subtyping, capture conversion and wildcards capture in method calls. Secondly, we present an implementation in the context of the EGO compiler. EGO is an approach for efficiently supporting runtime generics at compile-time: synthetic code is automatically added to the source code by the extended compiler, so as to create generic runtime type information on a by need basis, store it into object instances, and retrieve it when necessary in type-dependent operations. The solution discussed in this paper makes the EGO compiler the first reification approach entirely dealing with the present version of the Java programming language.

(keywords) Generic types, Wildcards, Java, Reification
       Author = {Cimadamore, Maurizio and Viroli, Mirko},
       Doi = {doi:10.1016/j.scico.2008.06.005},
       Editor = {Mernik, Marjan},
       Issn = {0167-6423},
       Journal = {Science of Computer Programming},
       Keywords = {Generic types, Wildcards, Java, Reification},
       Month = oct,
       Note = {Selected Papers from the 22th ACM Symposium on Applied Computing (SAC 2007)},
       Number = {2--3},
       Pages = {59--75},
       Publisher = {Elsevier Science B.V.},
       Title = {On the reification of {J}ava wildcards},
       Url = {http://www.sciencedirect.com/science/article/pii/S016764230800066X},
       Volume = 73,
       Year = 2008

Journals & Series

Partita IVA: 01131710376 - Copyright © 2008-2022 APICe@DISI Research Group - PRIVACY