Repository navigation
Ignore non-component fields when copying records to intermediary - #225
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #225 +/- ##
============================================
+ Coverage 85.85% 86.15% +0.30%
- Complexity 1175 1180 +5
============================================
Files 129 129
Lines 2630 2637 +7
Branches 307 309 +2
============================================
+ Hits 2258 2272 +14
+ Misses 241 234 -7
Partials 131 131 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
**Problem/trigger:** Mapping a record failed with `RecordMappingToIntermediaryException` (`NoSuchMethodException: <Record>.$$nameOfSyntheticField()`) when a class runs with instrumentation-added fields (#224). **Root cause:** `RecordToAnyConverter` looped over all declared fields of the generated intermediary class and looked up a same-named accessor on the record. The intermediary is generated in the package of the record, so a static, synthetic field was added that has no accessor on the record. **Solution:** Loop over the record components and read them with `RecordComponent.getAccessor()`. Copy a value only when the intermediary has a same-named field that is not static and not synthetic. Fixes #224 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
arjanvlek
force-pushed
the
fix/224-record-to-any-unknown-fields
branch
from
October 15, 2026 13:38
2d87e30 to
3dd21f6
Compare
|
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.



Fixes #224
Problem
Mapping a record failed with
RecordMappingToIntermediaryException(caused byNoSuchMethodException: <Record>.$$nameOfSyntheticField()) when classes were instrumented with tooling that adds fields to them.Root cause
RecordToAnyConverterlooped over all declared fields of the generated intermediary class and looked up a same-named accessor on the source record. The intermediary is generated in the package of the record, so instrumentation can add a static, synthetic field to it. That field has no accessor on the record, so the lookup failed.Solution
RecordComponent.getAccessor(), instead of looking up methods by field name.Tests
Added to
RecordToAnyConverterTest:public static syntheticfield, to simulate an instrumented class.The two intermediary tests fail without the fix (
NoSuchMethodException) and pass with it. The full suite passes (412 tests, 0 failures, 2 skipped).🤖 Generated with Claude Code