mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 08:31:28 +00:00
This commit introduces the ability to register a PlatformExtensionClashResolver in a container. Each PlatformExtensionClashResolver has a corresponding PlatformSpecificExtensions. If, during container composition, several instances of PlatformSpecificExtensions were registred, instead of throwing InvalidCardinalityException, corresponding PlatformExtensionClashResolver will be asked to resolve clash. This allows to make injection more composable and less coupled across different contributors of service, providing a basis for such motivating cases as composing containers with both JS and JVM services (for analysis of multiplatform modules). Previously, that would be impossible: a) JS would inject default instances for some services which would clash with non-default JVM services (like SyntheticScopes) b) Also, there are a very few services for which *both* platforms provide non-default implementations, so they should be merged manually on case-by-case basis (e.g., IdentifierChecker)