Practical Information

How to subscribe to Spoon's mailing list?

Go here and fill the form.

How to access Spoon's source code repository?


What is the meaning of each digit in the version X.Y.Z of spoon?

  • X is the digit for the major version (major new features or major incompatible API changes).
  • Y is the digit for the minor version (bug fixes or minor API changes).
  • Z is the digit for the critical bug fixes of the current major or minor version.


Where is the Spoon metamodel?

The Spoon metamodel consists of all interfaces that are in packages spoon.reflect.declaration (structural part: classes, methods, etc.) and spoon.reflect.code (behavioral part: if, loops, etc.).


How to prevent Annotation processors from consuming the annotations that they process?

By default, whenever an Annotation Processor processes a CtElement it will consume (delete) the processed annotation from it. If you want the annotation to be kept, override the init() method from the AbstractAnnotationProcessor class, and call the protected method clearConsumedAnnotationTypes like so:

public void init() {

How to compare and create type references in a type-safe way?

Use actual classes instead of strings.

CtTypeReference t=...
if(t.getActualClass()==int.class) { ... }
Factory f=...

How to parametrized the JDT compiler arguments?

SpoonModelBuilder exposes a method named build(JDTBuilder). This method compiles the target source code with data specified in the JDTBuilder parameter.

final String[] builder = new JDTBuilderImpl() //
        .classpathOptions(new ClasspathOptions().classpath(TEST_CLASSPATH).bootclasspath(TEST_CLASSPATH).binaries(".").encoding("UTF-8")) //
        .complianceOptions(new ComplianceOptions().compliance(8)) //
        .annotationProcessingOptions(new AnnotationProcessingOptions().compileProcessors()) //
        .advancedOptions(new AdvancedOptions().continueExecution().enableJavadoc().preserveUnusedVars()) //
        .sources(new SourceOptions().sources(".")) //