Skip to content

Add opt-in strict mode for builder and Jackson module generation failures - #194

Merged
AndreasIgel merged 10 commits into
java-helpers:mainfrom
AndreasIgel:feature/172-strict-builder-generation
Jul 26, 2026
Merged

Add opt-in strict mode for builder and Jackson module generation failures#194
AndreasIgel merged 10 commits into
java-helpers:mainfrom
AndreasIgel:feature/172-strict-builder-generation

Conversation

@AndreasIgel

@AndreasIgel AndreasIgel commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

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 accepts true); disable with DISABLED/false/unset.

What changed

  • strict is a first-class configuration option, not a side channel: new STRICT entry in CompilerArgumentsEnum (arg simplebuilder.strict), read by CompilerArgumentsReader.readBuilderConfiguration() as an OptionState and stored on BuilderConfiguration with accessor isStrictModeEnabled() — consistent with every other option.
  • Decision centralized in ProcessingContext via reportBasedOnStrictMode(...), 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 the processingOver() Jackson-module catch (that failure has only a package name, no annotated element).
    • ProcessingLogger gained the matching error(...) reporter.
  • BuilderProcessor both 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).
  • Docs: strict documented under a new Reliability section in docs/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 standalone JacksonModuleStrictModeTest was removed to avoid a third Jackson test class.

Combines the two strict-mode TODOs (builder + Jackson module generation) into one change since they share the option and file. Supersedes #195 (closed).

Fixes #172
Fixes #173

devin-ai-integration Bot and others added 2 commits July 15, 2026 08:51
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>
@AndreasIgel AndreasIgel changed the title Add opt-in strict mode for builder-generation failures Add opt-in strict mode for builder and Jackson module generation failures Jul 15, 2026
@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Comment thread README.md Outdated
devin-ai-integration Bot and others added 2 commits July 20, 2026 23:35
…trict mode, merge Jackson strict tests

Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
@sonarqubecloud

Copy link
Copy Markdown

@java-helpers java-helpers deleted a comment from github-actions Bot Jul 26, 2026
devin-ai-integration Bot and others added 2 commits July 26, 2026 19:12
…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>
@AndreasIgel
AndreasIgel merged commit 5934124 into java-helpers:main Jul 26, 2026
6 checks passed
@AndreasIgel
AndreasIgel deleted the feature/172-strict-builder-generation branch July 26, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant