JavaParser
Simple Story
JavaParser turns a pupil's .java file into a tree you can ask questions about, and can
work out what each name in that file refers to.
What it is
JavaParser parses Java source into an abstract syntax tree and offers visitors to walk it. The companion symbol solver resolves names to their declarations, which the tree alone cannot do.
How Ares 2 uses it
Ares depends on both javaparser-core and javaparser-symbol-solver-core. The
api/ast package builds structural assertions on top: the asserting
subpackage holds the assertions, model the representation and type the supported
constructs.
This supports exercise requirements about how a solution is written, which no runtime sandbox can express.
Further reading
- JavaParser — project site
- javaparser/javaparser — source repository
- Introduction to JavaParser — Baeldung
- Visitor Design Pattern in Java — Baeldung