Reified type parameters using Java annotations

  • Authors:
  • Prodromos Gerakios;Aggelos Biboudis;Yannis Smaragdakis

  • Affiliations:
  • University of Athens, Athens, Greece;University of Athens, Athens, Greece;University of Athens, Athens, Greece

  • Venue:
  • Proceedings of the 12th international conference on Generative programming: concepts & experiences
  • Year:
  • 2013

Quantified Score

Hi-index 0.00

Visualization

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.