HAL will be down for maintenance from Friday, June 10 at 4pm through Monday, June 13 at 9am. More information
Skip to Main content Skip to Navigation

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.
Document type :
Complete list of metadata

Cited literature [12 references]  Display  Hide  Download

Contributor : Rapport de Recherche Inria Connect in order to contact the contributor
Submitted on : Tuesday, May 23, 2006 - 4:53:34 PM
Last modification on : Friday, February 4, 2022 - 3:19:23 AM
Long-term archiving on: : Monday, September 17, 2012 - 4:01:34 PM


  • 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⟩



Record views


Files downloads