Add opt-in strict mode for builder and Jackson module generation failures - #194
Merged
AndreasIgel merged 10 commits intoJul 26, 2026
Merged
Conversation
Introduce a new annotation-processor option (-Asimplebuilder.strict=true) that promotes builder-generation failures from warnings to compiler errors, failing the build. The default is unchanged: failures remain warnings and the build succeeds. Adds the STRICT compiler argument, an element-aware error reporter, wires the flag into BuilderProcessor, documents it in README, and adds tests covering both default (warning) and strict (error) behavior. Fixes java-helpers#172 Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
Fold the Jackson-module strict handling (issue java-helpers#173) into the shared strict option so both builder and Jackson module generation failures are promoted to compiler errors under -Asimplebuilder.strict=true, default unchanged (warnings only). Adds JacksonModuleStrictModeTest and updates the README wording. Fixes java-helpers#173 Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
AndreasIgel
commented
Jul 20, 2026
Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
…anager.devin.ai/proxy/github.com/AndreasIgel/simple-builders-fork into feature/172-strict-builder-generation
AndreasIgel
commented
Jul 20, 2026
…trict mode, merge Jackson strict tests Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
…builder-generation
|
…TION.md (java-helpers#194) Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
…ce strict via configurationReader (java-helpers#194) Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Adds an opt-in strict/fail-fast mode for annotation-processor generation failures. When enabled, generation failures are promoted from compiler warnings to compiler errors that fail the build — covering both builder generation and Jackson-module generation. The default is unchanged (
DISABLED): failures stay warnings and the build still succeeds.Enable via
-Asimplebuilder.strict=ENABLED(also acceptstrue); disable withDISABLED/false/unset.What changed
strictis a first-class configuration option, not a side channel: newSTRICTentry inCompilerArgumentsEnum(argsimplebuilder.strict), read byCompilerArgumentsReader.readBuilderConfiguration()as anOptionStateand stored onBuilderConfigurationwith accessorisStrictModeEnabled()— consistent with every other option.ProcessingContextviareportBasedOnStrictMode(...), which emits an error when strict is enabled and a warning otherwise:reportBasedOnStrictMode(Element, format, args)— element-aware, used by the per-element builder-generation catch so the diagnostic points at the offending type.reportBasedOnStrictMode(format, args)— no-element overload, used by theprocessingOver()Jackson-module catch (that failure has only a package name, no annotated element).ProcessingLoggergained the matchingerror(...)reporter.BuilderProcessorboth catch blocks now call the shared helper (no duplicated if/else), and the redundant strict-mode debug log was removed (the full config is already logged).strictdocumented under a new Reliability section indocs/CONFIGURATION.md(with ToC entry + "All Compiler Options" reference), consistent with every other option (README links to the guide rather than documenting options inline).Validation
mvn -pl processor -am clean test— green, 288 processor tests. Coverage:StrictModeTest: builder default (collision → warning, compiles) vs strict (collision → error, fails).JacksonModuleWarningTest: existing Jackson warning tests plus the merged strict-mode Jackson tests (default → warning, strict → error). The former standaloneJacksonModuleStrictModeTestwas removed to avoid a third Jackson test class.Fixes #172
Fixes #173