Skip to content

[29%] Integrate critter-core into morphia-core #4179

@evanchooly

Description

@evanchooly

Goal

Integrate critter-core into morphia-core to provide a modern Mapper architecture using bytecode generation, replacing legacy reflection-based implementation. Users get a config-driven choice between mappers with automatic fallback.

Implementation Phases

Planning Document

Full implementation plan with code samples, file references, verification steps, and risk mitigation:
docs/critter-integration-plan.md

Design Decisions

Decision Choice
Generation strategy Hybrid: check classpath for pre-generated models (critter-maven AOT) → runtime generation (Gizmo + VarHandle) → reflection fallback
Runtime accessors VarHandle-based — no synthetic __read/__write methods needed at runtime
Language Convert to Java — convert critter Kotlin source before moving into morphia-core
Mapper interface @MorphiaInternal only — not exposed on any public API
Fallback granularity Entity-type level — all-or-nothing per type
copy() semantics Share immutable CritterEntityModel references
Dependencies Optional + fail-fast — Gizmo/ASM/ByteBuddy marked <optional>, clear error if missing when CRITTER selected
Classloader Uses configured classloader as parent; build-time classes are permanent, runtime classes regenerated per JVM start
Module removal Last step — only after full test matrix is green

Metadata

Metadata

Assignees

No one assigned

    Labels

    critterCritter bytecode generation integrationenhancement

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions