skip to main content
10.1145/2517208.2517223acmconferencesArticle/Chapter ViewAbstractPublication PagesgpceConference Proceedingsconference-collections
research-article

Reified type parameters using Java annotations

Published:27 October 2013Publication History

ABSTRACT

Java generics are compiled by-erasure: all clients reuse the same bytecode, with uses of the unknown type erased. C++ templates are compiled by-expansion: each type-instantiation of a template produces a different code definition. The two approaches offer trade-offs on multiple axes. We propose an extension of Java generics that allows by-expansion translation relative to selected type parameters only. This language design allows sophisticated users to get the best of both worlds at a fine granularity. Furthermore, our proposal is based on Java 8 Type Annotations (JSR 308) and the Checker Framework as an abstraction layer for controlling compilation without changes to the internals of a Java compiler.

References

  1. D. Ancona, G. Lagorio, and E. Zucca. Jam-Designing a Java Extension with Mixins. ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5):641--712, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. R. Cardone, A. Brown, S. McDirmid, and C. Lin. Using Mixins to Build Flexible Widgets. In Proceedings of the 1st International Conference on Aspect-Oriented Software Development (AOSD), pages 76--85, New York, NY, USA, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. W. Dietl, S. Dietzel, M. D. Ernst, K. Muşlu, and T. W. Schiller. Building and using Pluggable Type-Checkers. In Proceedings of the 33rd International Conference on Software Engineering, pages 681--690, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. B. Eckel. Mixins: Something Else You Can't Do With Java Generics? http://www.artima.com/weblogs/viewpost.jsp?thread=132988, Oct. 2005.Google ScholarGoogle Scholar
  5. N. Gafter. Super Type Tokens. http://gafter.blogspot.gr/2006/12/super-type-tokens.html, Dec. 2006.Google ScholarGoogle Scholar
  6. T. Kamina and T. Tamai. McJava - A Design and Implementation of Java with Mixin-Types. In Proceedings of the Programming Languages and Systems: Second Asian Symposium, (APLAS), pages 4--6, Taipei, Taiwan, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  7. M. Odersky. The Scala Language Specification, 2013.Google ScholarGoogle Scholar
  8. M. Odersky and P. Wadler. Pizza into Java: translating theory into practice. In Proceedings of the 24th ACM SIGPLAN-SIGACT symposium on Principles of Programming languages (POPL), POPL '97, pages 146--159, New York, NY, USA, 1997. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. M. Papi, M. Ali, T. L. Correa, Jr., J. H. Perkins, and M. D. Ernst. Practical Pluggable Types for Java. In Proceedings of the 2008 International Symposium on Software Testing and Analysis, ISSTA '08, pages 201--212, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. A. Sampson, W. Dietl, E. Fortuna, D. Gnanapragasam, L. Ceze, and D. Grossman. EnerJ: approximate data types for safe and general low-power computation. In Proceedings of the 32nd ACM SIGPLAN conference on Programming Language Design and Implementation (PLDI), pages 164--174, San Jose, California, USA, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. J. Sasitorn and R. Cartwright. Efficient First-Class Generics on Stock Java Virtual Machines. In Proceedings of the 2006 ACM symposium on Applied computing, SAC '06, pages 1621--1628, New York, NY, USA, 2006. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Y. Smaragdakis and D. Batory. Implementing Layered Designs with Mixin Layers. In Proceedings of the 12th European Conference on Object-Oriented Programming (ECOOP), pages 550--570. Springer-Verlag LNCS 1445, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Y. Smaragdakis and D. Batory. Mixin-Based Programming in C++. In Generative and Component-Based Software Engineering Symposium (GCSE), pages 163--177. Springer-Verlag, LNCS 2177, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. M. VanHilst and D. Notkin. Using C++ Templates to Implement Role-Based Designs. In JSSST International Symposium on Object Technologies for Advanced Software, pages 22--37. Springer Verlag, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. VanHilst and D. Notkin. Using Role Components to Implement Collaboration-Based Designs. In Proceedings of the 1996 ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA), pages 359--369, San Jose, California, USA, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Reified type parameters using Java annotations

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          GPCE '13: Proceedings of the 12th international conference on Generative programming: concepts & experiences
          October 2013
          198 pages
          ISBN:9781450323734
          DOI:10.1145/2517208

          Copyright © 2013 ACM

          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 the author(s) 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].

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 27 October 2013

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article

          Acceptance Rates

          GPCE '13 Paper Acceptance Rate20of59submissions,34%Overall Acceptance Rate56of180submissions,31%

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader