Reifying wildcards in Java using the EGO approach

  • Authors:
  • Maurizio Cimadamore;Mirko Viroli

  • Affiliations:
  • Alma Mater Studiorum--Università di Bologna, Cesena, Italy;Alma Mater Studiorum--Università di Bologna, Cesena, Italy

  • Venue:
  • Proceedings of the 2007 ACM symposium on Applied computing
  • Year:
  • 2007

Quantified Score

Hi-index 0.01

Visualization

Abstract

Providing runtime information about generic types---that is, reifying generics---is a challenging problem studied in several research papers in the last years. However, the quest for finding effective and efficient solutions specifically targeted to the Java programming language is still open. In particular, the new mechanism of wildcards introduced in Java 5.0 significantly complicates the overall semantics of generics: its reification aspects are currently unexplored and pose serious implementation issues. In this paper we analyse such issues and study how they have been supported in the context of the EGO compiler. EGO is an approach for efficiently supporting runtime generics at compile-time in Java: synthetic code is automatically added to the source code by the 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. We show how the design of EGO has been completely and successfully extended to represent wildcard types, and how we deal with subtle issues concerning subtyping, capture conversion and wildcards capture in method calls.