Skip to content

Koin 3.5 is not binary-compatible with 3.2 #2153

@diegobcunha

Description

@diegobcunha

Describe the bug
If a library is compiled using Koin 3.2, and an app using Koin 3.5 tries to use that library, a runtime exception can occur.

Koin 3.5 appears to be source-compatible with 3.3, but is not binary-compatible.

To Reproduce

  1. Declare a library with a dependency on Koin 3.2.4
  2. Define an entrypoint which uses the koinApplication { } API as instructed in insert-koin.io's "Context Isolation" documentation
  3. Define an app with a dependency on both the test library and Koin 3.5.6 (using BOM)
  4. Invoke the library's entrypoint in an app
    An exception similar to the following will be produced:

No static method koinApplication(Lkotlin/jvm/functions/Function1;)Lorg/koin/core/KoinApplication; in class Lorg/koin/dsl/KoinApplicationKt; or its super classes (declaration of 'org.koin.dsl.KoinApplicationKt' appears in […])

Expected behavior
Maven dependency resolution will select 3.5.6 over 3.2.4 because they are theoretically semver-compatible and 3.5.6 is higher.
Library will continue to function as expected, with isolated context.

Snippet or Sample project to help reproduce
This also happened at here #1829.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions