A Model for Java with Wildcards

Wildcards are a complex and subtle part of the Java type system, present since version 5.0. Although there have been various formalisations and partial type soundness results concerning wildcards, to the best of our knowledge, no system that includes all the key aspects of Java wildcards has been proven type sound. This paper establishes that Java wildcards are type sound. We describe a new formal model based on explicit existential types whose pack and unpack operations are handled implicitly, and prove it type sound. Moreover, we specify a translation from a subset of Java to our formal model, and discuss how several interesting aspects of the Java type system are handled.

[1]  Luca Cardelli,et al.  Abstract Types and the Dot Notation , 1990, Programming Concepts and Methods.

[2]  S. Drossopoulou,et al.  Towards an Existential Types Model for Java Wildcards , 2007 .

[3]  Sophia Drossopoulou,et al.  On subtyping, wildcards, and existential types , 2009, FTfJP@ECOOP.

[4]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 2001, TOPL.

[5]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..

[6]  John C. Mitchell,et al.  Abstract types have existential types , 1985, POPL.

[7]  Rachid Guerraoui,et al.  ECOOP’ 99 — Object-Oriented Programming , 1999, Lecture Notes in Computer Science.

[8]  Craig Chambers,et al.  Ownership Domains: Separating Aliasing Policy from Mechanism , 2004, ECOOP.

[9]  Frank Pfenning,et al.  Automated Deduction - CADE-21, 21st International Conference on Automated Deduction, Bremen, Germany, July 17-20, 2007, Proceedings , 2007, CADE.

[10]  John C. Mitchell,et al.  Abstract types have existential type , 1988, TOPL.

[11]  Dave Thomas,et al.  ECOOP 2006 - Object-Oriented Programming , 2006 .

[12]  Martin Odersky ECOOP 2004 – Object-Oriented Programming , 2004, Lecture Notes in Computer Science.

[13]  Brian Campbell,et al.  Amortised Memory Analysis Using the Depth of Data Structures , 2009, ESOP.

[14]  Mads Torgersen,et al.  Unifying Genericity - Combining the Benefits of Virtual Types and Parameterized Classes , 1999, ECOOP.

[15]  Michael Norrish,et al.  Barendregt's Variable Convention in Rule Inductions , 2007, CADE.

[16]  Sophia Drossopoulou,et al.  Multiple ownership , 2007, OOPSLA.

[17]  Dan Grossman Existential Types for Imperative Languages , 2002, ESOP.

[18]  Mirko Viroli,et al.  On Variance-Based Subtyping for Parametric Types , 2002, ECOOP.

[19]  Gilad Bracha,et al.  Adding Wildcards to the Java Programming Language , 2004, J. Object Technol..

[20]  Gilad Bracha,et al.  Adding wildcards to the Java programming language , 2004, SAC '04.

[21]  Florin Craciun,et al.  A flow-based approach for variant parametric types , 2006, OOPSLA '06.

[22]  James Gosling,et al.  The Java Language Specification, 3rd Edition , 2005 .

[23]  Guy L. Steele,et al.  Java(TM) Language Specification, The (3rd Edition) (Java (Addison-Wesley)) , 2005 .

[24]  Benjamin C. Pierce,et al.  Bounded quantification is undecidable , 1992, POPL '92.

[25]  Giovanni Rimassa,et al.  Understanding access restriction of variant parametric types and Java wildcards , 2005, SAC '05.

[26]  Giovanni Rimassa,et al.  On Access Restriction with Java Wildcards , 2005, J. Object Technol..

[27]  Mirko Viroli,et al.  Variant parametric types: A flexible subtyping scheme for generics , 2006, TOPL.

[28]  Benjamin C. Pierce,et al.  Types and programming languages: the next generation , 2003, 18th Annual IEEE Symposium of Logic in Computer Science, 2003. Proceedings..

[29]  Sophia Drossopoulou,et al.  Tribe: a simple virtual class calculus , 2007, AOSD.

[30]  Harold T. Hodes,et al.  The | lambda-Calculus. , 1988 .

[31]  Dave Clarke,et al.  Existential Owners for Ownership Types , 2007, J. Object Technol..

[32]  Benjamin C. Pierce,et al.  Bounded Existentials and Minimal Typing , 1998, Theor. Comput. Sci..

[33]  Yi Lu,et al.  On Ownership and Accessibility , 2006, ECOOP.

[34]  Luca Cardelli,et al.  On understanding types, data abstraction, and polymorphism , 1985, CSUR.

[35]  Ole Lehrmann Madsen,et al.  Virtual classes: a powerful mechanism in object-oriented programming , 1989, OOPSLA '89.

[36]  B. Pierce,et al.  On Decidability of Nominal Subtyping with Variance , 2006 .

[37]  S. Drossopoulou,et al.  Tribe: More Types for Virtual Classes , 2007 .

[38]  Maribel Fernández The Lambda Calculus , 2009 .