Spoon: Program Analysis and Transformation in Java

Renaud Pawlak 1 Carlos Noguera 1 Nicolas Petitprez 1
1 JACQUARD - Weaving of Software Components
LIFL - Laboratoire d'Informatique Fondamentale de Lille, Inria Lille - Nord Europe
Abstract : In this research report, we present Spoon, a framework for program transformation and static analysis in Java. More precisely, Spoon is an open and extensible Java compiler, written in pure Java by using Compile-time reflection techniques. We take advantage of the new features added by Java 5, and particularly of annotations and generics. Using annotations within the Spoon framework allows the programmer to extend the Java language without defining new syntactic elements, and in such a way that it is naturally supported by IDEs for Java 5 and greater. Generics, as a priceless complement, allow for the well-typing of Spoon programs that implement the programmers' language extensions. Enforcing typing naturally provides better IDE support (such as static checks, completion, documentation, and navigation), and also allows us to define a pure Java template mechanism, which we use as a tool to define well-typed and straightforward program transformations. In addition to its basic transformation capabilities, Spoon comes with a partial evaluation engine that is used to calculate the control flow of the program and to simplify the results of template-based transformations for correctness, optimization, and readability. In order to demonstrate the usability and usefulness of our framework, we present three applications, which have been chosen to cover most of Spoon's features: a translator from Java 1.4 programs into well-typed Java 5 programs, an efficient template-based AOP extension, and an automatic implementation and validation of the visitor pattern.
Type de document :
[Research Report] RR-5901, Inria. 2006
Liste complète des métadonnées

Littérature citée [12 références]  Voir  Masquer  Télécharger

Contributeur : Rapport de Recherche Inria <>
Soumis le : mardi 23 mai 2006 - 16:53:34
Dernière modification le : jeudi 21 février 2019 - 10:52:44
Document(s) archivé(s) le : lundi 17 septembre 2012 - 16:01:34



  • HAL Id : inria-00071366, version 1



Renaud Pawlak, Carlos Noguera, Nicolas Petitprez. Spoon: Program Analysis and Transformation in Java. [Research Report] RR-5901, Inria. 2006. 〈inria-00071366〉



Consultations de la notice


Téléchargements de fichiers