discoverWrappersFromConfig

fun discoverWrappersFromConfig(resolver: Resolver, logger: KSPLogger): Map<String, CollectionWrapperDescriptor>

Reads all @KMapperConfig.wrappers listings (in-module, works on KMP/iOS), resolves each wrapper object's @CollectionWrapper.forType, and validates the duck-typed wrap/unwrap contract via CollectionWrapperValidator to build Map.

Design:

  • No cross-module symbol enumeration (getDeclarationsFromPackage / getSymbolsWithAnnotation for dependency packages) — only the consumer's own @KMapperConfig is read (in-module).

  • For each KClass listed in @KMapperConfig.wrappers, resolve its @CollectionWrapper.forType by reading the annotation on the resolved dependency class. This is standard dependency annotation resolution, which works cross-module in KSP2.

  • Signature validation: wrap/unwrap shapes are checked against forType; a bad shape or a wrapper with neither direction → logger.error (causes COMPILATION_ERROR).

  • Duplicate forType (same collection type listed via two wrapper objects) → logger.error (causes COMPILATION_ERROR).

This replaces the old descriptor-generation + getDeclarationsFromPackage machinery which failed in KSP2's per-module kspCommonMainMetadata invocations.