InsertKoinIO / koin-annotations

Koin Annotations - About Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform insert-koin.io
https://insert-koin.io
Apache License 2.0
154 stars 40 forks source link

Generated module code is broken when annotations are ordered in the wrong way #93

Open janseeger opened 11 months ago

janseeger commented 11 months ago

Describe the bug Depending on the order different code is generated, which leads to weird behaviour.

To Reproduce

@Scope
class A

@Scope(A::class)
@Scoped
@KoinViewModel
class B: ViewModel

produces

scope<A> {
  scoped { B }
}

while

@Scope
class A

@KoinViewModel
@Scoped
@Scope(A::class)
class B: ViewModel

will produce

scope<A> {
  viewModel { B }
}

Expected behavior This isn't obvious and should perhaps be documented or fixed that any order results in the same code.

Koin module and version: koin-annotations:1.3.0

arnaudgiuliani commented 11 months ago

thanks for your feedback