Understanding access restriction of variant parametric types and Java wildcards

  • Authors:
  • Giovanni Rimassa;Mirko Viroli

  • Affiliations:
  • Whitestein Technologies AG Pestalozzistrasse, Zurich, Switzerland;DEIS, Università degli Studi di Bologna a Cesena, Italy

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

Quantified Score

Hi-index 0.00

Visualization

Abstract

Variant parametric types [8] have been introduced to provide a flexible subtyping mechanism for generic types, and are recently being developed into Java wildcards [15], shipped worldwide with the JDK 1.5 release. The two approaches, which are strictly related, retain safety by providing rather peculiar and non-trivial mechanisms to restrict access to a class functionalities (methods and fields). In this paper we aim at studying a unified framework to describe this issue in detail, and to facilitate the understanding and exploitation of this new programming concept.Our work is both technical and conceptual. On the one hand, we provide formal rules to access restriction and specialise them for the two approaches, so as to emphasise similarities and differences. On the other hand, we show that such rules promote a natural description and understanding of access restriction in terms of the ability of (instances of) a generic class to produce/consume elements of the abstracted type.