Repository navigation
feat: support explicit builder property mapping - #484
igel-devin-ai wants to merge 9 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Strict reviewchanges needed Reviewed head
Verification
Other-PR integration review
Recheck at
|
| # | Original finding (short) | Status | Remaining action |
|---|---|---|---|
| 1 | Inherited generic Optional copy loses value | fixed | — |
| 2 | Ignored setter falsely duplicates mapping | fixed; regression missing — minor | Add ignored/active duplicate-mapping test (BuilderDefinitionCreator.java:594–596). |
| 3 | Inaccessible explicit getter called | fixed; regression missing — minor | Test private and cross-package protected getters (BuilderDefinitionCreator.java:1061–1066). |
| 4 | Runtime copy/default coverage | partially fixed — minor | Test no-op with and empty Optional fallback (BuilderPropertyTest.java:62–147). |
| 5 | Test-string convention | not fixed — nit | Convert source expectations and new helper diagnostic to text blocks (BuilderPropertyTest.java:55–57,165–167; ProcessorTestUtils.java:127–131). |
Build: Java 17 full mvn -B verify — BUILD SUCCESS; 1,421 tests, 0 failures/errors; example compile succeeds without tracked drift; mapping/copy probes behave correctly.
Recheck at 619ec391 (2026-12-06)
Verdict: minor changes
| Severity | What is missing | Where (file:line) |
|---|---|---|
| minor | Partial: protected-getter fixture lacks @BuilderProperty and expects success; add the annotated cross-package diagnostic case. |
BuilderPropertyTest.java:410–435 |
| minor | Partial: test with(...), not only copy constructor; empty-Optional fixture must observe a real default (getter is constant/setter ignores writes). |
BuilderPropertyTest.java:330–383 |
| nit | Partial: expected generated-source fixtures remain ordinary strings; helper diagnostic is now a text block. | BuilderPropertyTest.java:55–57,165–167 |
…ject inaccessible explicit mappings - findCompatibleGetter and the explicit-mapping path now resolve method return types via Types.asMemberOf in the receiver's declared-type context, so inherited Optional<T> getters are compared as Optional<String> instead of being rejected (silent copy value loss) - explicitly mapped getters that are inaccessible from the builder package are rejected with a processor error instead of emitting uncompilable calls
…ing validation validateExplicitSetters now runs on the same relevance-filtered method set the builder uses, so an @IgnoreInBuilder setter no longer breaks a valid explicit mapping with a duplicate-property error
|
Strict-review progress — findings 1–3 fixed:
Verified: full processor suite green (702 tests). Remaining from the review: finding 4's runtime regression assertions (no-op copy fidelity) and the inherited-generic compile regression — adding those next. |
compileToClassLoader harness compiles fixtures with the BuilderProcessor into a temp dir for runtime execution; the Optional-getter copy and the explicitly mapped constructor-property copy are verified to preserve values end-to-end
|
Finding 4 done: runtime copy-fidelity regression assertions are in. A new That completes all four strict-review findings here — the inherited-generic case is covered by the |
…egression The copy-expression generation classified Optionality on the unresolved return type, emitting initialValue instead of initialValueOf for inherited Optional<T> getters - uncompilable. Now resolved via the receiver type context. Regression: inheritedGenericOptionalGetterCopyPreservesValueAtRuntime compiles and executes the full chain end-to-end.
|
Correction and completion on the inherited-generic case: the first runtime probe exposed that the Optional classification still used the unresolved return type when generating the copy expression — Note: the probe also revealed a separate pre-existing bug outside this PR's scope — an inherited generic setter ( |
- Runtime: no-op copy carries every property value; empty Optional getter falls back to unset without failing the copy - Validation: private explicit getter mappings are rejected as inaccessible; cross-package protected getters never produce uncompilable builders - Ignored duplicate setter mappings (@IgnoreInBuilder) accepted without warnings - Diagnostic assembly in the classloader harness converted to a text block
|
Recheck items addressed — all four:
Full processor suite green (17/17 in BuilderPropertyTest incl. the new tests). |
…g (S3776) - AnnotationProcessingContext had ExecutableElement imported twice - extractSetterFields exceeded cognitive complexity 15 — the per-setter extraction moved into extractFieldFromRelevantSetter, counting behavior unchanged
|


Fixes #458.
Summary
@BuilderPropertyfor explicit setter, getter, and constructor-parameter property mappingOptional<T>getters withTrackedValue.initialValueOf@BuilderPropertyVerification
mvn clean verify