test(mapper): pin local-fields-only databind contract for inherited criteria fields - #205
Open
shihyuho wants to merge 1 commit into
Open
test(mapper): pin local-fields-only databind contract for inherited criteria fields#205shihyuho wants to merge 1 commit into
shihyuho wants to merge 1 commit into
Conversation
…riteria fields ReflectionDatabind.of() uses doWithLocalFields, which only visits fields declared directly on the target's concrete class. Fields inherited from a superclass criteria POJO are silently excluded from databinding. Add a test that pins this current behavior with a subclass criteria POJO, so any future switch to doWithFields becomes a deliberate, test-visible decision. Also add a Javadoc note documenting the contract on the affected method. Closes #199 Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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
Closes #199
Pins the current
doWithLocalFields-based, local-fields-only contract ofReflectionDatabind.of()with a test — this PR does not change any behavior.ReflectionDatabind.of()usesReflectionUtils.doWithLocalFields, which only visits fields declared directly on the target's concrete class. Fields inherited from a superclass criteria POJO are silently excluded from databinding.ReflectionDatabindTest#inheritedFieldsAreNotDatabound, which builds aChildCriteria extends ParentCriteriaPOJO (the parent carries an@Spec-annotated field) and asserts that the field lookup only contains the target-only entry and the child's own declared field — the inheritedparentfield is absent.ReflectionDatabind.of(...)overload documenting the local-fields-only contract, so the limitation is discoverable at the source.Whether inherited fields should be databound (e.g. switching to
doWithFields) is a separate, deliberate maintainer decision — out of scope here.Test plan
make test— green (JDK 17 via SDKMAN; toolchain JDK on this machine resolves to 25 by default)mvn -pl mapper test -Dtest=ReflectionDatabindTest— 2/2 passing, including the new pinning testnpx --yes -p @commitlint/cli -p @commitlint/config-conventional commitlint --last --extends @commitlint/config-conventional— passes🤖 Generated with Claude Code