koin-annotations
koin-annotations copied to clipboard
Wrong check of optional module when KOIN_CONFIG_CHECK is enabled
Describe the bug
The module for code generation is correct when the dependency is optional, but the KSP check will report an error.
To Reproduce
- Disable
KOIN_CONFIG_CHECK
@Module
@ComponentScan
class MyModule
@Scope(MyScopeClass::class)
@Scoped
class MyScopeComponent(private val component2: MyScopeComponent2?)
class MyScopeComponent2
// Code gen
public val kntr_base_log_MyModule : Module = module {
single() { kntr.base.log.Factory() } bind(kntr.base.log.ILogger::class)
scope<kntr.base.log.MyScopeClass> {
scoped() { kntr.base.log.MyScopeComponent(component2=getOrNull()) }
}
}
public val kntr.base.log.MyModule.module : org.koin.core.module.Module get() = kntr_base_log_MyModule
- Enable
KOIN_CONFIG_CHECK
error: [ksp] --> Missing Definition type 'kntr.base.log.MyScopeComponent2' for 'kntr.base.log.MyScopeComponent'. Fix your configuration to define type 'MyScopeComponent2'.
Expected behavior Pass the configuration check correctly
Koin project used and used version (please complete the following information): koin-annotation: 1.3.1