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 :
Reports
Complete list of metadatas

Cited literature [12 references]  Display  Hide  Download

https://hal.inria.fr/inria-00071366
Contributor : Rapport de Recherche Inria <>
Submitted on : Tuesday, May 23, 2006 - 4:53:34 PM
Last modification on : Thursday, February 21, 2019 - 10:52:44 AM
Long-term archiving on : Monday, September 17, 2012 - 4:01:34 PM

Identifiers

  • HAL Id : inria-00071366, version 1

Collections

Citation

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

Share

Metrics

Record views

1297

Files downloads

1522