An Error Prone compiler plugin that enforces strict coding rules as guard rails for AI-generated Java code.
Aether Style Guard is an Error Prone compiler plugin that turns five stylistic conventions into compile-time diagnostics, so that AI-assisted Java code comes out uniform, self-documenting, and easy to review. Every rule the plugin enforces is motivated by a real pain point with AI-generated code: implicit field accesses, missing nullness annotations, parameters that the model "forgets" to mark final, non-void methods without a nullability contract, and Javadoc that is either missing or half-finished.
The project dogfoods every single rule through its own selfcheck Maven profile. The plugin builds, installs locally, and then rebuilds its own source tree through itself as a final sanity check before any release goes out.
Note
Aether Style Guard is a member of the Aether Framework family of Java tooling. Its flagship sibling is Aether Datafixers, from which this project inherits its release process, build layout, and contributor conventions.
- Quick Start
- The Five Rules
- Installation
- Configuration
- Dogfooding
- Why AI Guard Rails?
- Building from Source
- Contributing
- Security
- License
Maven
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.36.0</version>
</path>
<path>
<groupId>de.splatgames.aether.styleguard.labs</groupId>
<artifactId>aether-style-guard</artifactId>
<version>0.1.1</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>mvn clean compileThe compiler will now surface stylistic violations as ordinary javac errors (or warnings, for the Javadoc-presence check). Most violations come with a ready-to-apply auto-fix.
mvn -DcompilerArgument="-XepPatchChecks:RequireThisPrefix,RequireParameterNullness,RequireFinalParameter,RequireMethodReturnNullness -XepPatchLocation:IN_PLACE" compile| Rule | Severity | Summary | Auto-Fix |
|---|---|---|---|
| RequireThisPrefix | ERROR | Every instance-field access must be qualified with this.. |
β |
| RequireParameterNullness | ERROR | Every reference-type parameter must carry @NotNull or @Nullable. |
β |
| RequireFinalParameter | ERROR | Every parameter that is not reassigned inside the body must be declared final. |
β |
| RequireMethodReturnNullness | ERROR | Every non-void, non-primitive method return value must carry a nullness annotation. | β |
| RequireJavadocPresent | WARNING | Public and protected methods should have a Javadoc comment. | β |
| RequireJavadocComplete | ERROR | Any Javadoc on a public or protected method must document every value parameter and the return value. | β |
The Javadoc rule is split across two checkers because Error Prone allows only one severity per @BugPattern. Together they enforce: "if you write Javadoc, write it completely; if you do not write any, that is at least worth a warning."
The plugin accepts nullness annotations from every major Java ecosystem, so projects can keep whatever they already use:
org.jetbrains.annotations.NotNull/Nullable(default for auto-fixes)jakarta.annotation.Nonnull/Nullablejavax.annotation.Nonnull/Nullablejakarta.validation.constraints.NotNull,javax.validation.constraints.NotNullorg.jspecify.annotations.NonNull/Nullableorg.checkerframework.checker.nullness.qual.NonNull/Nullableorg.springframework.lang.NonNull/Nullableedu.umd.cs.findbugs.annotations.NonNull/Nullableandroidx.annotation.NonNull/Nullable,android.support.annotation.NonNull/Nullablelombok.NonNull
Maven
<dependency>
<groupId>de.splatgames.aether.styleguard.labs</groupId>
<artifactId>aether-style-guard</artifactId>
<version>0.1.1</version>
</dependency>Gradle (Groovy / Kotlin)
// Groovy
errorprone 'de.splatgames.aether.styleguard.labs:aether-style-guard:0.1.1'// Kotlin
errorprone("de.splatgames.aether.styleguard.labs:aether-style-guard:0.1.1")The plugin is
provided-scope at consumer build time: it participates in compilation through theannotationProcessorPathof themaven-compiler-pluginand ships no runtime code to the consuming application.
Every rule ships with sensible defaults. Two settings can be overridden per build via standard Error Prone flags:
| Flag | Purpose | Default |
|---|---|---|
-XepOpt:AetherStyleGuard:NotNull=<fqn> |
FQN of the @NotNull annotation inserted by auto-fixes |
org.jetbrains.annotations.NotNull |
-XepOpt:AetherStyleGuard:Nullable=<fqn> |
FQN of the @Nullable annotation used alongside the @NotNull choice |
org.jetbrains.annotations.Nullable |
Rules can be individually silenced with standard Error Prone syntax, e.g. -Xep:RequireJavadocPresent:OFF.
This project uses its own plugin to lint its own source tree. The selfcheck Maven profile re-compiles src/main/java with aether-style-guard active, so any drift between the rules and the plugin's own code immediately becomes a build failure.
# Step 1: install the plugin locally
mvn clean install
# Step 2: rebuild the sources through the plugin
mvn compile -PselfcheckA green selfcheck is part of the release checklist in RELEASE.md.
AI-generated Java code is usually syntactically correct but stylistically drifty: one file is sprinkled with this., the next one is not; one method carries @NotNull on its parameters, the next one omits it; one constructor declares every parameter final, the next one relies on implicit effective-finality. This inconsistency is cheap to fix after the fact but expensive to review when it accumulates across a codebase.
Aether Style Guard collapses those decisions into five compile-time rules with auto-fixes, so the AI model can emit whatever it likes and the compiler rewrites it into the house style automatically. The result is a codebase where every file reads as if it came from the same author.
Requirements: Java 17+, Maven 3.9.5+
# Build and install locally
mvn clean install
# Run unit tests only
mvn test
# Run the selfcheck (dogfood the plugin)
mvn compile -Pselfcheck
# Build a signed release candidate (requires GPG config)
mvn clean verify -PreleaseWe welcome contributions of all kinds - new checkers, bug fixes, documentation improvements, and discussions.
Please read our Contributing Guide before submitting a pull request. This project follows the Contributor Covenant Code of Conduct. For AI-assisted contributions, please review our AI Usage Guidelines - especially relevant for this project, since it exists to set the tone for what good AI-assisted Java should look like.
All release artifacts are GPG-signed and published to Maven Central. The project uses automated security scanning via CodeQL, OWASP Dependency-Check, and Dependabot.
To report a vulnerability, see our Security Policy.
This project is licensed under the MIT License.
Copyright (c) 2025-2026 Splatgames.de Software and Contributors.