skip to main content
10.1145/1244002.1244286acmconferencesArticle/Chapter ViewAbstractPublication PagessacConference Proceedingsconference-collections
Article

Reifying wildcards in Java using the EGO approach

Published: 11 March 2007 Publication History

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.

References

[1]
O. Agesen, S. Freund, and J. C. Mitchell. Adding parameterized types to Java. In Conference on Object-Oriented Programming, Systems, Languages and Applications, pages 215--230, Atlanta, Georgia, 5--9 October, 1997. ACM, New York.
[2]
A. Igarashi, B. C. Pierce, and P. Wadler. Featherweight Java: A minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems, 23:396--450, 2001.
[3]
A. Igarashi and M. Viroli. Variant parametric types: A flexible subtyping scheme for generics. ACM Transactions on Programming Languages and Systems, 28(5):795--847, 2006.
[4]
B. Joy, J. Gosling, G. Steele, and G. Bracha. The Java Language Specification (Second Edition). Addison-Wesley, New York, 2002.
[5]
A. C. Meyers, J. A. Bank, and B. Liskov. Parameterized types for Java. In Symposium on Principles of Programming Languages, pages 132--145, Paris, France, 15--17 January, 1997. ACM, New York.
[6]
Microsoft. C# language specification 2.0. Technical report, Microsoft, 2003. Web site: http://msdn.microsoft.com/vcsharp.
[7]
M. Odersky, P. Wadler, G. Bracha, and D. Stoutamire. Making the future safe for the past: Adding Genericity to the Java programming language. In Conference on Object-Oriented Programming, Systems, Languages and Applications, pages 183--200. ACM, New York, 1998.
[8]
J. Sasitorn and R. Cartwright. Efficient first-class generics on stock java virtual machines. In H. Haddad, editor, Proceedings of the 2006 ACM Symposium on Applied Computing (SAC), Dijon, France, April 23--27, 2006, pages 1621--1628. ACM, 2006.
[9]
D. Syme and A. Kennedy. Design and implementation of generics for the .NET Common Language Runtime. In Programming Languages Design and Implementation, Snowbird, Utah, 20--22 June, June 2001. ACM, New York.
[10]
M. Torgersen. The expression problem revisited: four solutions using generics. In Proceedings of the 18th European Conference on Object-Oriented Programming (ECOOP'2004), volume 1445 of LNCS, pages 523--549, Oslo, Norway, June 2004. Springer.
[11]
M. Torgersen, C. Plesner Hansen, P. von der Ahé, E. Ernst, G. Bracha, and N. Gafter. Adding wildcards to the java programming language. Journal of Object Technology, 11(3):1--20, 2004.
[12]
M. Viroli. Effective and efficient compilation of run-time generics in Java. In V. Bono, M. Bugliesi, and S. Drossopoulou, editors, 2nd Workshop on Object-Oriented Developments (WOOD 2004), volume 138(2) of Electronic Notes in Theoretical Computer Science, pages 95--116. Elsevier Science B. V., CONCUR 2004, London, UK, 30 August 2004.
[13]
M. Viroli and A. Natali. Parametric Polymorphism in Java: an approach to translation based on reflective features. In Conference on Object-Oriented Programming, Systems, Languages and Applications, pages 146--165, Minneapolis, USA, 15--19 October, 2000. ACM, New York.
[14]
M. Viroli and G. Rimassa. On access restriction with Java wildcards. Journal of Object Technology, 4(10), 2005. Special Issue: OOPS Track at ACM SAC 2005.

Cited By

View all
  • (2012)Java wildcards meet definition-site varianceProceedings of the 26th European conference on Object-Oriented Programming10.1007/978-3-642-31057-7_23(509-534)Online publication date: 11-Jun-2012

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
SAC '07: Proceedings of the 2007 ACM symposium on Applied computing
March 2007
1688 pages
ISBN:1595934804
DOI:10.1145/1244002
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 11 March 2007

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. java generics
  2. java wildcards
  3. variant parametric types

Qualifiers

  • Article

Conference

SAC07
Sponsor:

Acceptance Rates

Overall Acceptance Rate 1,650 of 6,669 submissions, 25%

Upcoming Conference

SAC '25
The 40th ACM/SIGAPP Symposium on Applied Computing
March 31 - April 4, 2025
Catania , Italy

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 22 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2012)Java wildcards meet definition-site varianceProceedings of the 26th European conference on Object-Oriented Programming10.1007/978-3-642-31057-7_23(509-534)Online publication date: 11-Jun-2012

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media