Skip to content

test(mapper): pin local-fields-only databind contract for inherited criteria fields - #205

Open
shihyuho wants to merge 1 commit into
jakartafrom
test/wp10-inherited-criteria-fields
Open

test(mapper): pin local-fields-only databind contract for inherited criteria fields#205
shihyuho wants to merge 1 commit into
jakartafrom
test/wp10-inherited-criteria-fields

Conversation

@shihyuho

Copy link
Copy Markdown
Member

Summary

Closes #199

Pins the current doWithLocalFields-based, local-fields-only contract of ReflectionDatabind.of() with a test — this PR does not change any behavior.

  • ReflectionDatabind.of() uses ReflectionUtils.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.
  • Added ReflectionDatabindTest#inheritedFieldsAreNotDatabound, which builds a ChildCriteria extends ParentCriteria POJO (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 inherited parent field is absent.
  • Added a Javadoc note on the affected 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 test
  • npx --yes -p @commitlint/cli -p @commitlint/config-conventional commitlint --last --extends @commitlint/config-conventional — passes

🤖 Generated with Claude Code

…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WP10] Mapper test-coverage gap: inherited criteria-POJO fields

1 participant