Skip to content

Spoon Notes

Links: - API Docs - Documentation - Spoon examples - Github Repository - spoon-maven-plugin - spoon-smpl

1 Installation

  1. maven plugin
  2. jar 包下载

2 Code Analysis

2.1 AST

构建 java代码的 AST

java -cp .\spoon-core-9.2.0-beta-7-jar-with-dependencies.jar spoon.Launcher -i .\MyClass.java --gui
image.png

2.2 Code Analysis

static code analysis

3 Spoon Meta Model

The Spoon meta-model can be split into three parts:

  • The structural part contains the declarations of the program elements, such as interface, class, variable, method, annotation, and enum declarations.
  • The code part contains the executable Java code, such as the one found in method bodies.
  • The reference part models the references to program elements (for instance a reference to a type).

3.1 Structural Elements

image.png

3.2 Code Elements

image.png

3.3 References

image.png