Effective type parametrization in Java

Type parametrization is an essential construct in modern programming languages, Java offers generics, C++ offers templates for highly reusable code. The mechanism between these constructs differs and affects usage and runtime performance, as well. Java uses type erasure, C++ deals with instantiation...

Ausführliche Beschreibung

Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Soha, Péter, Pataki, Norbert
Format: Tagungsbericht
Sprache:eng
Schlagworte:
Online-Zugang:Volltext
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
Beschreibung
Zusammenfassung:Type parametrization is an essential construct in modern programming languages, Java offers generics, C++ offers templates for highly reusable code. The mechanism between these constructs differs and affects usage and runtime performance, as well. Java uses type erasure, C++ deals with instantiations. In this paper, we argue for a new approach in Java which is similar to C++ template construct. The proposed method contains a template syntax and a developed tool which can instantiate Java templates and generates Java source code. The templates have advantages related to special template parameters that are not supported by generics. On the other hand, the instantiations have to be processed at compilation time, but the runtime performance of the code is improved. We measure how the Java templates speed-up the execution.
ISSN:0094-243X
1551-7616
DOI:10.1063/1.5114360