Checkstyle is a Java static analysis tool that enforces coding standards: indentation, naming conventions, Javadoc, and more. When run via Ant, it parses source files into an Abstract Syntax Tree (AST) and applies rule checks to it. The DetailAST class is Checkstyle’s own representation of individual AST nodes.

If you’re running Checkstyle via an Ant task and see this error:

checkstyle:
[checkstyle] Running Checkstyle 6.11.2 on 2324 files
[checkstyle] Can't find/access AST Node type com.puppycrawl.tools.checkstyle.api.DetailAST

…there are no helpful search results, and the error message gives you nothing to go on.

Root cause Link to heading

The problem is a classpath conflict with ANTLR. Checkstyle uses ANTLR internally to parse Java source into ASTs. If ant-antlr is installed as a separate system package, its ANTLR version conflicts with the one bundled inside Checkstyle, and the wrong DetailAST class ends up on the classpath.

Check if you have these packages installed:

rpm -qa | grep -i antlr

If you see something like:

ant-antlr-1.9.4-9.2.noarch
antlr-java-2.7.7-103.38.noarch
antlr-2.7.7-103.38.x86_64

The culprit is ant-antlr. Remove it:

zypper remove ant-antlr     # openSUSE
# or
apt remove ant-antlr        # Debian/Ubuntu

After removing the conflicting package, re-run Checkstyle. The DetailAST error disappears because Checkstyle now uses its own bundled ANTLR without interference.

Why this happens Link to heading

Ant has optional tasks (like <checkstyle>) that can use system-installed ANTLR via ant-antlr. When both ant-antlr and a tool with bundled ANTLR (like Checkstyle) are present, class loading can pick up the wrong version, particularly if the system ANTLR uses a different package name or class structure than the bundled one. Removing the system-level ant-antlr forces everything through Checkstyle’s own bundled dependency.