DescriptorSnapshotExtractor

The default SnapshotExtractor: a vendored, runtime SerialDescriptor walk (design §4, spike #6). It reads compatibility-bearing facts straight off the compiled descriptor — the highest-fidelity source, seeing @SerialName, isElementOptional, nullability, @JsonNames, enum values, sealed subtypes, and SerializersModule-resolved open polymorphism.

The graph is walked breadth-first keyed by contract identity — serial name plus, for a sealed/polymorphic subtype, the base it was reached through (#200) — so cyclic and shared references are captured exactly once and terminate, and subtypes of different bases may share a @SerialName. An identity that turns out to carry two different shapes (e.g. generic instantiations) is recorded as an OPAQUE coverage gap.

@EncodeDefault is not a @SerialInfo annotation and so is absent from getElementAnnotations; its mode is recovered from the model class's bytecode by EncodeDefaultReader instead, and left null (unknown) when that fails (#158, §14).

Functions

Link copied to clipboard
open override fun extract(roots: Iterable<SerialDescriptor>, module: SerializersModule = EmptySerializersModule(), config: SnapshotConfig = SnapshotConfig()): Snapshot

Walks the roots descriptor graphs into a Snapshot.

fun extract(roots: Iterable<SerialDescriptor>, module: SerializersModule, config: SnapshotConfig, genericRoots: Iterable<SerialDescriptor>): Snapshot

As extract, plus genericRoots — descriptors for root-only generic types resolved with type-parameter holes (#139). They are walked after roots and share the same visited-set, so a generic whose serial name was already reached concretely in roots is skipped (fill-if-absent): the concrete instantiation wins, which avoids both snapshot churn and orphaning the concrete type arguments the primary walk enqueued.