Traits were proposed as a mechanism for fine-grained code reuse to overcome many limitations of class-based inheritance. A trait is a set of methods that is independent from any class hierarchy and can be flexibly used to build other traits or classes by means of a suite of composition operations. In this paper we present the new version of Xtraitj, a trait-based programming language that features complete compatibility and interoperability with the Java platform. Xtraitj is implemented in Xtext and Xbase, and it provides a full Eclipse IDE that supports an incremental adoption of traits in existing Java projects. The new version of Xtraitj allows traits to be accessed from any Java project or library, even if the original Xtraitj source code is not available, since traits can be accessed in their byte-code format. This allows developers to create Xtraitj libraries that can be provided in their binary only format. We detail the technique we used to achieve such an implementation; this technique can be reused in other languages implemented in Xtext for the Java platform. We formalize our traits by means of flattening semantics and we provide some performance benchmarks that show that the runtime overhead introduced by our traits is acceptable.

Xtraitj: Traits for the Java platform

DAMIANI, Ferruccio
2017-01-01

Abstract

Traits were proposed as a mechanism for fine-grained code reuse to overcome many limitations of class-based inheritance. A trait is a set of methods that is independent from any class hierarchy and can be flexibly used to build other traits or classes by means of a suite of composition operations. In this paper we present the new version of Xtraitj, a trait-based programming language that features complete compatibility and interoperability with the Java platform. Xtraitj is implemented in Xtext and Xbase, and it provides a full Eclipse IDE that supports an incremental adoption of traits in existing Java projects. The new version of Xtraitj allows traits to be accessed from any Java project or library, even if the original Xtraitj source code is not available, since traits can be accessed in their byte-code format. This allows developers to create Xtraitj libraries that can be provided in their binary only format. We detail the technique we used to achieve such an implementation; this technique can be reused in other languages implemented in Xtext for the Java platform. We formalize our traits by means of flattening semantics and we provide some performance benchmarks that show that the runtime overhead introduced by our traits is acceptable.
2017
131
419
441
http://www.sciencedirect.com/science/article/pii/S0164121216301297
Eclipse; IDE; Implementation; Java; Trait; Software; Information Systems; Hardware and Architecture
Bettini, Lorenzo; Damiani, Ferruccio
File in questo prodotto:
File Dimensione Formato  
JSS-PublishedOnline-2016-07-26-OPEN.pdf

Open Access dal 28/07/2018

Descrizione: Articolo principale (rivista)
Tipo di file: POSTPRINT (VERSIONE FINALE DELL’AUTORE)
Dimensione 866.48 kB
Formato Adobe PDF
866.48 kB Adobe PDF Visualizza/Apri
JSS-BettiniDamiani-2017.pdf

Accesso riservato

Descrizione: Articolo principale (rivista)
Tipo di file: PDF EDITORIALE
Dimensione 5.31 MB
Formato Adobe PDF
5.31 MB Adobe PDF   Visualizza/Apri   Richiedi una copia

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/2318/1616676
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 4
  • ???jsp.display-item.citation.isi??? 3
social impact