Skip to content

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

Description

@shihyuho

此內容由 AI 產生(specification-mapper 全庫審查 2026-07-16.執行圖)。

Work package WP10 · findings: TEST-03 · worst severity: medium · effort: S

From the 2026-07-16 whole-codebase review of branch jakarta (snapshot 7de4a33; modules mapper/ + starter/). Every finding below is CONFIRMED by independent adversarial verification. File:line coordinates are from the snapshot and may have drifted.

Trimmed since the review. The review's WP10 also carried TEST-05 (nested-AND typo) and TEST-06 (single-threaded concurrency test); both were fixed post-review by PR #187 (verified on jakarta HEAD). Only TEST-03 survives, so this package is reduced to it.

Findings

TEST-03 — Inherited fields of criteria POJOs are silently ignored (doWithLocalFields) and no test pins this contract (testing, medium)

  • File: mapper/src/main/java/tw/com/softleader/data/jpa/spec/ReflectionDatabind.java:80
  • Evidence (re-confirmed on jakarta HEAD): newFieldLookup uses ReflectionUtils.doWithLocalFields(target.getClass(), …), which visits only fields declared on the concrete class — fields inherited from a superclass criteria POJO are never databound. No test in ReflectionDatabindTest exercises a subclass criteria POJO, so the contract (intended or not) is unpinned.

Plan

  1. Add a test with a criteria POJO that extends a base criteria class carrying an annotated field, asserting the current behavior: the inherited field is not databound (i.e. pin doWithLocalFields' local-only contract) — so any future switch to doWithFields becomes a deliberate, test-visible decision.
  2. Add a short Javadoc note on newFieldLookup stating the local-fields-only contract, so the limitation is discoverable at the source.

Scope note: this pins the current behavior. Whether inherited fields should be databound is a separate behavior-change decision left to the maintainer; this package does not make that change.

Acceptance criteria

  • A new ReflectionDatabindTest case pins the inherited-field behavior and passes.
  • Regression: make test green.

Metadata

Metadata

Assignees

Labels

status: ready-for-agentFully specified and ready for an autonomous AFK agent to implementtype: enhancementNew feature or request

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions