Spoon
spoon.gforge.inria.fr
What it is
Spoon is a free, open-source library for analyzing, rewriting, transforming, and transpiling Java source code. It parses source files into an abstract syntax tree (AST), then exposes APIs for inspecting and changing that model. Processors can perform source-level static analysis on selected AST element types, while architectural rules can be expressed as AST checks and run as JUnit tests in continuous integration. Transformation facilities cover instrumentation and refactoring, including helpers for local and generic variables and removing deprecated methods. Spoon can also provide shared analysis of binary and source code through CtClass objects as an alternative to Java reflection. The project supports Java source up to Java 25, but runtime requirements vary: Spoon 11.x needs JDK 17 or later, 10.x needs JDK 11 or later, and 9.x needs Java 8. It is available through Java, the command line, Maven, and Gradle, with a dependency JAR on Maven Central. Command-line use requires manual classpath handling and source dependencies specified with --source-classpath. Spoon is an official Inria project and an OW2 consortium member.
Spec sheet
- What it does
- Spoon is an open-source library for analyzing, rewriting, transforming, and transpiling Java source code through an abstract syntax tree (AST).Read 5 Oct 2026 · spoon.gforge.inria.fr
- Purpose
- Spoon is an open-source library for analyzing, rewriting, transforming, and transpiling Java source code.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Integrations
- The site documents Maven and Gradle usage, along with command-line execution using a JAR from Maven Central.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Support
- The site directs users seeking professional development, training, or extension support to comment on a GitHub issue.Read 5 Oct 2026 · spoon.gforge.inria.fr
- License
- Spoon is free and open source under the CeCILL-C and MIT licenses.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Analysis
- Spoon supports source-level static code analysis using processors that inspect AST elements of a selected type.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Architecture checks
- The documentation describes expressing architectural rules as AST analysis and running them as JUnit tests in continuous integration.Read 5 Oct 2026 · spoon.gforge.inria.fr
- AST model
- It parses Java source files into an abstract syntax tree with analysis and transformation APIs.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Code transformation
- Spoon can transform source code, including for instrumentation and refactoring.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Command-line limitation
- When using Spoon from the command line, users handle the classpath manually and should specify dependencies of analyzed source files with --source-classpath.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Community
- The project welcomes external contributions through pull requests.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Compatibility limit
- Although it can consume source code for older Java versions, Spoon needs the specified JDK version to run.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Install options
- The documentation describes using Spoon from Java, the command line, Maven, or Gradle, and downloading its dependency jar from Maven Central for command-line use.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Java runtime requirements
- Spoon 11.x requires JDK 17 or later, Spoon 10.x requires JDK 11 or later, and Spoon 9.x requires Java 8.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Java support
- The site says Spoon supports modern Java versions up to Java 25.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Parallel processing
- Spoon provides an AbstractParallelProcessor API for running processors in parallel, with the documentation advising against using more parallel processors than available cores.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Project affiliation
- The site identifies Spoon as an official Inria open-source project and a member of the OW2 open-source consortium.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Refactoring
- The documentation describes local-variable and generic-variable refactoring helpers, as well as a helper for removing deprecated methods.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Reflection
- Spoon can act as an alternative to Java reflection and allows shared analysis of binary and source code through CtClass objects.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Runtime requirement
- Spoon 11.x requires JDK 17 or later, 10.x requires JDK 11 or later, and 9.x requires Java 8 to run.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Semantic patching
- The spoon-smpl submodule is described as a prototype implementation of a subset of Semantic Patch Language for a subset of Java.Read 5 Oct 2026 · spoon.gforge.inria.fr
- Static analysis
- Spoon supports source-level static analysis through processors that inspect AST elements.Read 5 Oct 2026 · spoon.gforge.inria.fr
Plans and prices
Strong points and limits
Strong points
- Free under CeCILL-C and MIT licenses
- Supports Java source through Java 25
- AST processors enable source-level static analysis
- Architectural checks can run as JUnit tests
- Usable from Maven, Gradle, Java, or command line
Limits
- Runtime JDK requirement varies by Spoon release
- Command-line users manage classpaths manually
- Semantic patching is described as a prototype subset
- Parallel processing guidance depends on available cores
Who it suits
Spoon suits Java developers who need AST-based analysis, repository refactoring, instrumentation, or transpilation. It also fits teams enforcing architectural rules through JUnit and continuous integration.
Verdict
Spoon provides a broad AST toolkit for Java analysis and source transformation, with documented refactoring and CI-oriented architecture checks. Its release-specific JDK requirements and manual command-line classpath work are important implementation details.
Where Specifiction places it
- Code Refactoring Tools#10 of 227.8