Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

Spoon

spoon.gforge.inria.fr

  • Free plan
  • Linux
  • API
  • Self-hosted

What Spoon is

Spoon is a free, open-source Java library for analyzing and changing source code. It parses Java files into an abstract syntax tree (AST), then provides APIs to inspect, rewrite, transform and transpile that structure. Its processors support source-level static analysis by examining selected AST elements. Developers can express architecture rules as AST checks and run them as JUnit tests in continuous integration. Transformation uses include instrumentation and refactoring, with documented helpers for variable refactoring and removing deprecated methods. Spoon can also serve as an alternative to Java reflection, using CtClass objects to analyze binary and source code together. It supports modern Java versions up to Java 25, but the required runtime depends on the Spoon release: 11.x needs JDK 17 or later, 10.x needs JDK 11 or later, and 9.x needs Java 8. Spoon can be used from Java, the command line, Maven or Gradle, with a dependency JAR available from Maven Central. Command-line users must manage the classpath manually and specify analyzed-source dependencies with --source-classpath. Spoon is an official Inria project and part of the OW2 open-source consortium.

Who it suits

Spoon suits Java developers who need AST-based analysis, source transformations or refactoring. It is also relevant to teams that want to run architecture checks as JUnit tests in continuous integration.

Good to know, and what to watch

  • Analyzes and transforms Java source through an AST
  • Architecture checks can run as JUnit tests
  • Supports Java versions up to Java 25
  • Works with Java, command line, Maven and Gradle
  • Free under CeCILL-C and MIT licenses
  • Spoon 11.x requires JDK 17 or later
  • Command-line users manage the classpath manually
  • The semantic patching module is a prototype for a subset

Free and Open Source

Free

Free plan

Getting started

  1. Open the Spoon website
  2. Choose Java, Maven, Gradle, or command-line usage
  3. Install a compatible JDK for the Spoon release
  4. Add Spoon through Maven or Gradle, or download its dependency JAR from Maven Central
  5. For command-line analysis, set the classpath and provide analyzed-source dependencies with --source-classpath

Limits to check

Spoon 11.x requires JDK 17 or later, 10.x requires JDK 11 or later, and 9.x requires Java 8. Command-line operation requires users to manage the classpath and source dependencies themselves.

The verdict

Spoon provides Java-focused AST APIs for analysis and source changes, with documented workflows for build tools and CI checks. Match the Spoon release to its JDK requirement, and account for manual classpath setup when using the command line.

Questions people ask

Is Spoon free?

Yes. Spoon is free and open source under the CeCILL-C and MIT licenses, with no paid plans or usage limits stated.

Which Java versions does it support?

The site says Spoon supports modern Java versions up to Java 25. The JDK needed to run it depends on the Spoon release.

How can Spoon be installed or used?

Documentation covers use from Java, the command line, Maven, and Gradle. A dependency JAR is available from Maven Central.

What JDK does each release require?

Spoon 11.x requires JDK 17 or later, 10.x requires JDK 11 or later, and 9.x requires Java 8.

Can Spoon enforce architecture rules?

Yes. Architectural rules can be expressed as AST analysis and run as JUnit tests in continuous integration.

What the maker publishes

Analysis
Spoon supports source-level static code analysis using processors that inspect AST elements of a selected type. source
Architecture checks
The documentation describes expressing architectural rules as AST analysis and running them as JUnit tests in continuous integration. source
AST model
It parses Java source files into an abstract syntax tree with analysis and transformation APIs. source
Code transformation
Spoon can transform source code, including for instrumentation and refactoring. source
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. source
Community
The project welcomes external contributions through pull requests. source
Compatibility limit
Although it can consume source code for older Java versions, Spoon needs the specified JDK version to run. source
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. source
Integrations
The site documents Maven and Gradle usage, along with command-line execution using a JAR from Maven Central. source
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. source
Java support
The site says Spoon supports modern Java versions up to Java 25. source
License
Spoon is free and open source under the CeCILL-C and MIT licenses. source
Parallel processing
Spoon provides an AbstractParallelProcessor API for running processors in parallel, with the documentation advising against using more parallel processors than available cores. source
Project affiliation
The site identifies Spoon as an official Inria open-source project and a member of the OW2 open-source consortium. source
Purpose
Spoon is an open-source library for analyzing, rewriting, transforming, and transpiling Java source code. source
Refactoring
The documentation describes local-variable and generic-variable refactoring helpers, as well as a helper for removing deprecated methods. source
Reflection
Spoon can act as an alternative to Java reflection and allows shared analysis of binary and source code through CtClass objects. source
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. source
Semantic patching
The spoon-smpl submodule is described as a prototype implementation of a subset of Semantic Patch Language for a subset of Java. source
Static analysis
Spoon supports source-level static analysis through processors that inspect AST elements. source
Support
The site directs users seeking professional development, training, or extension support to comment on a GitHub issue. source
What it does
Spoon is an open-source library for analyzing, rewriting, transforming, and transpiling Java source code through an abstract syntax tree (AST). source

Checked against the maker's pages on 5 Oct 2026.