Open
Conversation
Tests cover runtime model generation, caching, copy semantics, null/non-entity handling, and concurrent mapping. Tests intentionally fail to compile until CritterMapper is implemented. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- testCopyHasIndependentDiscriminatorLookup: assert discriminator lookup instances are not same (not just mapper instances) - testConcurrentMappingProducesSingleModel: collect all futures first, shut down pool before assertions - Replace fully-qualified org.testng.Assert.assertNull calls with static import assertNull - Add explicit no-arg constructor to CritterMapperTestEntity Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds CritterMapper as a hybrid mapper that discovers entity models via: 1. Pre-generated models from the classpath (critter-maven AOT output) 2. Runtime Gizmo+VarHandle generation via CritterGizmoGenerator 3. Reflection-based fallback (standard EntityModel) The copy constructor shares immutable CritterEntityModel references across copies while creating independent DiscriminatorLookup instances. mapEntity is synchronized to prevent concurrent registration of the same type. All 8 TestCritterMapper tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…erMapper Add a comment on the copy constructor explaining why super(other) cannot be used (it would call new EntityModel() for CritterEntityModel instances) and the resulting known discrepancy that custom converters registered post- construction are not shared with copies. Add a comment on mapEntity explaining why the method is synchronized (race condition in DiscriminatorLookup). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Make copy constructor public with @MorphiaInternal annotation - Add @hidden and @morphia.internal Javadoc tags to both constructors - Change LOG.error to LOG.warn for graceful fallback paths in tryLoadPregenerated and tryRuntimeGeneration Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
CritterMapper extends AbstractMapperwith three-tier entity model discoveryCritterGizmoGenerator(Gizmo + VarHandle)EntityModelcopy()shares immutableCritterEntityModelreferences; clones reflective fallback modelsConcurrentHashMap.newKeySet()(logs once, not on every access)synchronized mapEntityprevents concurrent duplicate-discriminator race conditionCloses #4187
Test plan
TestCritterMapper— 8 tests: runtime generation, collection name, caching, copy semantics, concurrent access, null/non-entity inputsmorphia-coresuite — 1,231 tests, zero failures🤖 Generated with Claude Code