Section: Software
Keywords : Program transformation.
Spoon
Participants : Carlos Francisco Noguera Garcia, Renaud Pawlak [ correspondant ] , Nicolas Petitprez.
Spoon [17] , [50] is a project that started in March 2005 and was officially hosted by INRIA Gforge in September 2005. The goal of Spoon is to provide a core API and associated tools for static analysis and generative programming within the Java 5+ environment. Spoon must be seen as a basis to ensure Software Quality through code validation and generation. It can be used in the software development process during the validation phases, as well as for engineering or re-engineering software.
The first key point of Spoon is to provide a well-typed and comprehensive AST API which is designed to facilitate analysis and transformation work for programmers. Scanners and processors allow the programmer to implement various program traversal strategies on the Java program. Also, the program representation is built with a well known and well tested open source Java compiler: The Eclipse JDT compiler, which ensures the support of the latest Java features.
The second key point of Spoon is to provide a pure Java API to specify program transformations using a well-typed generative programming technique (called Spoon Templates). By using well-typed templates, Spoon makes programming of transformations easier and safer for the end-user programmers.
Finally, the third key point of Spoon is that it provides an Eclipse plugin (SpoonJDT) that allows the programmers to package validations and transformations into compilation components called Spoonlets. These components can be deployed in the Eclipse plugin to enhance the Java compiler in a seamless and well-integrated way. For example, thanks to Eclipse's incremental compilation, errors and warnings coming from Spoonlets are reported as regular compilation mistakes, along with the typing of the program. The fact that Spoonlet-defined errors can be reported as the programmer types in the code (exactly like spelling or grammar mistakes are reported real-time by modern text editors) is of primary importance to produce high-quality code. Indeed, it is a recognized fact that the exact moment a programmer introduces a defect in the program is also the best time to fix it - because it is the moment when the programmer has the best understanding of what has just been written.
Many projects and experiments have been conducted around Spoon in the Jacquard project, but also in other INRIA projects and outside of INRIA, by independent developers. A non-exhaustive list follows:
-
Spoon-AOP: a work on implementing AOP with Spoon in the context of middleware [17] .
-
AVal: a work done within the PhD of Carlos Nogera and that consists of a framework for validating annotation sets forming DSLs. This work was published in [33] .
-
Fraclet: a work done in the context of Nicolas Pessemier's PhD, in collaboration with Romain Rouvoy, that defines and implements a Java annotation based DSL for Fractal, the ObjectWeb component model. This work was published in [40] .
-
AOKell: an alternative implementation of the ObjectWeb Fractal container using AOP and Spoon.
-
Spoon-EMF: a work done by Olivier Barais (TRISKELL INRIA Project) to provide an EMF compliant implementation of the Spoon API.
-
Spoon-JMX: a work done by Didier Donsez (Grenoble University) for automatically transforming Java programs to support JMX.
-
JUnit Suite Maker: a project to control your JUnit tests with Spoon and started by an independent developer. See http://perso.orange.fr/peupeu/sw/java/junitsuitemaker/junitsuitemaker.html .
-
VSuite: a validation suite for Java started by Renaud Pawlak and Nicolas Petitprez.
Spoon is open source software available at http://spoon.gforge.inria.fr