Nothing Special   »   [go: up one dir, main page]

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

Adding wildcards to the Java programming language

Published: 14 March 2004 Publication History

Abstract

This paper describes wildcards, a new language construct designed to increase the flexibility of object-oriented type systems with parameterized classes. Based on the notion of use-site variance, wildcards provide a type safe abstraction over different instantiations of parameterized classes, by using '?' to denote unspecified type arguments. Thus they essentially unify the distinct families of classes often introduced by parametric polymorphism. Wildcards are implemented as part of the upcoming addition of generics to the Java™ programming language, and will thus be deployed world-wide as part of the reference implementation of the Java compiler javac available from Sun Microsystems, Inc. By providing a richer type system, wildcards allow for an improved type inference scheme for polymorphic method calls. Moreover, by means of a novel notion of wildcard capture, polymorphic methods can be used to give symbolic names to unspecified types, in a manner similar to the "open" construct known from existential types. Wildcards show up in numerous places in the Java Platform APIs of the upcoming release, and some of the examples in this paper are taken from these APIs.

References

[1]
O. Agesen, S. N. Freund, and J. C. Mitchell. Adding type parameterization to the java programming language. In Object Oriented Programming: Systems, Languages and Applications, Atlanta, Georgia, Oct. 1997. OOPSLA97, ACM Press. Toby Bloom, editor.]]
[2]
P. America and F. van der Linden. A parallel object-oriented language with inheritance and subtyping. In Object Oriented Programming: Systems, Languages and Applications/European Conference on Object-Oriented Programming, pages 161--168, Ottawa, Canada, Oct. 1990. OOPSLA/ECOOP90, ACM Press. Norman K. Meyrowitz, editor.]]
[3]
G. Bracha and D. Griswold. Strongtalk: Typechecking smalltalk in a production environment. In Object Oriented Programming: Systems, Languages and Applications, Washington DC, Oct. 1993. OOPSLA93, ACM Press. Andreas Paepcke, editor.]]
[4]
G. Bracha, M. Odersky, D. Stoutamire, and P. Wadler. Making the future safe for the past: Adding genericity to the java programming language. In OOPSLA98 {26}.]]
[5]
K. Bruce. Subtyping is not a good match for object-oriented programming languages. In ECOOP97 {11}.]]
[6]
K. Bruce, M. Odersky, and P. Wadler. A statically safe alternative to virtual types. In European Conference on Object-Oriented Programming, Brussels, Belgium, July 1998. ECOOP98, LNCS 1445, Springer Verlag. Eric Jul, editor.]]
[7]
R. Cartwright and G. L. Steele. Compatible genericity with runtime-types for the Java programming language. In OOPSLA98 {26}.]]
[8]
W. Cook. A proposal for making Eiffel type-safe. In European Conference on Object-Oriented Programming, pages 57--70, Nottingham, England, July 1989. ECOOP89, Cambridge University Press. Stephen Cook, editor.]]
[9]
W. Cook, W. Hill, and P. Canning. Inheritance is not subtyping. In Principles of Programming Languages, pages 125--135, San Francisco, California, Jan. 1990. POPL90, ACM Press. Paul Hudak, editor.]]
[10]
ECMA. C# language specification. http://www.ecma-international.org/publications/standards/Ecma-334.htm, 2002.]]
[11]
ECOOP97. European Conference on Object-Oriented Programming, Jyväskylä, Finland, June 1997. LNCS 1241, Springer Verlag. Mehmet Akşit and Satoshi Matsuoka, editors.]]
[12]
ECOOP99. European Conference on Object-Oriented Programming, Lisbon, Portugal, June 1999. LNCS 1628, Springer Verlag. Rachid Guerraoui, editor.]]
[13]
M. A. Ellis and B. Stroustrup. The Annotated C++ Reference Manual. Addison-Wesley, 1990.]]
[14]
E. Ernst. gbeta - a Language with Virtual Attributes, Block Structure, and Propagating, Dynamic Inheritance. PhD thesis, Department of Computer Science, University of Aarhus, Århus, Denmark, 1999.]]
[15]
A. Igarashi, B. Pierce, and P. Wadler. Featherweight Java: A minimal core calculus for Java and GJ. In Object Oriented Programming: Systems, Languages and Applications, pages 132--146, Denver, Colorado, Oct. 1999. OOPSLA99, ACM Press. Linda Northrop, editor.]]
[16]
A. Igarashi and B. C. Pierce. Foundations for virtual types. In ECOOP99 {12}.]]
[17]
A. Igarashi and M. Viroli. On variance-based subtyping for parametric types. In European Conference on Object-Oriented Programming, pages 441--469, Málaga, Spain, June 2002. ECOOP02, LNCS 2374, Springer Verlag. Boris Magnusson, editor.]]
[18]
A. Kennedy and D. Syme. Design and implementation of generics for the .NET common language runtime. In C. Norris and J. J. B. Fenwick, editors, Proceedings of the ACM SIGPLAN '01 Conference on Programming Language Design and Implementation (PLDI-01), volume 36.5 of ACM SIGPLAN Notices, pages 1--12, N.Y., June 20--22 2001. ACMPress.]]
[19]
D. MacQueen. SML '97 conversion guide. http://www.smlnj.org/doc/Conversion/index.html, 2003.]]
[20]
O. L. Madsen, B. Môller-Pedersen, and K. Nygaard. Object-Oriented Programming in the BETA Programming Language. Addison-Wesley, 1993.]]
[21]
B. Meyer. Genericity versus inheritance. In Object Oriented Programming: Systems, Languages and Applications, pages 391--405, Portland, Oregon, Nov. 1986. OOPSLA86, ACM Press. Norman K. Meyrowitz, editor.]]
[22]
R. Milner, M. Tofte, R. W. Harper, and D. MacQueen. The Definition of Standard ML. MIT Press, 1997.]]
[23]
J. C. Mitchell and G. D. Plotkin. Abstract types have existential types. ACM Transactions on Programming Languages and Systems, 1988.]]
[24]
A. Myers, J. Bank, and B. Liskov. Parameterized types for Java. In Conf. Proceedings of the 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), Paris, France, Jan. 1997. POPL97, ACM Press. Neil D. Jones, editor.]]
[25]
M. Odersky and P. Wadler. Pizza into Java: Translating theory into practice. In Conference Record of POPL '97: The 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 146--159, Paris, France, 15--17 Jan. 1997.]]
[26]
OOPSLA98. Object Oriented Programming: Systems, Languages and Applications, Vancouver, BC, Oct. 1998. ACM Press. Craig Chambers, editor.]]
[27]
C. V. Russo. First-class structures for standard ML. Lecture Notes in Computer Science, 1782:336++, 2000.]]
[28]
D. Stoutamire and S. Omohundro. The Sather 1.1 specification. Technical Report TR-96-012, International Computer Science Institute, Berkeley, CA, Aug. 1996.]]
[29]
K. K. Thorup. Genericity in Java with virtual types. In ECOOP97 {11}, pages 444--471.]]
[30]
K. K. Thorup and M. Torgersen. Unifying genericity. In ECOOP99 {12}, pages 186--204.]]
[31]
M. Torgersen. Virtual types are statically safe. In K. Bruce, editor, 5th Workshop on Foundations of Object-Oriented Languages, San Diego, CA, Jan. 1998.]]
[32]
M. Torgersen. Unifying Abstractions. PhD thesis, Computer Science Department, University of Aarhus, bogade 34, DK-8200 rhus N, Sept. 2001.]]

Cited By

View all

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
SAC '04: Proceedings of the 2004 ACM symposium on Applied computing
March 2004
1733 pages
ISBN:1581138121
DOI:10.1145/967900
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: 14 March 2004

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. genericity
  2. parameterized types
  3. wildcards

Qualifiers

  • Article

Conference

SAC04
Sponsor:
SAC04: The 2004 ACM Symposium on Applied Computing
March 14 - 17, 2004
Nicosia, Cyprus

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)12
  • Downloads (Last 6 weeks)0
Reflects downloads up to 28 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Decidable Subtyping of Existential Types for JuliaProceedings of the ACM on Programming Languages10.1145/36564218:PLDI(1091-1114)Online publication date: 20-Jun-2024
  • (2022)Instantiation of Java GenericsActa Cybernetica10.14232/actacyb.28407325:4(897-908)Online publication date: 21-Jan-2022
  • (2021)Type Inference in Java: Characteristics and LimitationsCybernetics, Cognition and Machine Learning Applications10.1007/978-981-33-6691-6_15(131-137)Online publication date: 31-Mar-2021
  • (2017)Familia: unifying interfaces, type classes, and family polymorphismProceedings of the ACM on Programming Languages10.1145/31338941:OOPSLA(1-31)Online publication date: 12-Oct-2017
  • (2017)Towards a Java Subtyping OperadProceedings of the 19th Workshop on Formal Techniques for Java-like Programs10.1145/3103111.3104043(1-6)Online publication date: 18-Jun-2017
  • (2016)Java and scala's type systems are unsound: the existential crisis of null pointersACM SIGPLAN Notices10.1145/3022671.298400451:10(838-848)Online publication date: 19-Oct-2016
  • (2016)Java and scala's type systems are unsound: the existential crisis of null pointersProceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications10.1145/2983990.2984004(838-848)Online publication date: 19-Oct-2016
  • (2016)ThisType for Object-Oriented LanguagesACM Transactions on Programming Languages and Systems10.1145/288839238:3(1-66)Online publication date: 8-Apr-2016
  • (2015)Lightweight, flexible object-oriented genericsACM SIGPLAN Notices10.1145/2813885.273800850:6(436-445)Online publication date: 3-Jun-2015
  • (2015)Lightweight, flexible object-oriented genericsProceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/2737924.2738008(436-445)Online publication date: 3-Jun-2015
  • Show More Cited By

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