Irsath Kareem
06/01/2026, 11:13 AM// @PropertyValue(...) is not working as intended in Koin compiler 1.0.0
// Defined as per documentation says only
@Factory
class ApiConfig(
@Property("base_url")
val baseUrl: String
) {
companion object {
@PropertyValue("base_url")
const val DEFAULT_URL: String = "https://uidev.docker.com"
}
}
@Module
@ComponentScan("com.techullurgy.chessk.temp")
class PrivateModule
@Composable
@Preview
fun TestLifecycle() {
KoinApplicationPreview(
application = {
// properties( // This is working, BUT COMMENTED FOR NOW
// mapOf(
// "base_url" to "https://uidev.hostinger.com"
// )
// )
modules(PrivateModule::class)
}
) {
val config = koinInject<ApiConfig>()
BasicText(
text = config.baseUrl
)
}
}
java.lang.RuntimeException: Exception while generating code for:
FUN LOCAL_FUNCTION_FOR_LAMBDA name:module$lambda$0$0 visibility:private modality:FINAL returnType:com.techullurgy.chessk.temp.ApiConfig
VALUE_PARAMETER kind:Regular name:<this> index:0 type:org.koin.core.scope.Scope
VALUE_PARAMETER kind:Regular name:params index:1 type:org.koin.core.parameter.ParametersHolder
BLOCK_BODY
RETURN type=kotlin.Nothing from=‘private final fun module$lambda$0$0 (<this>: org.koin.core.scope.Scope, params: org.koin.core.parameter.ParametersHolder): com.techullurgy.chessk.temp.ApiConfig declared in com.techullurgy.chessk.temp.ComTechullurgyChesskTempPrivateModuleModuleKt’
CONSTRUCTOR_CALL ‘public constructor <init> (baseUrl: kotlin.String) [primary] declared in com.techullurgy.chessk.temp.ApiConfig’ type=com.techullurgy.chessk.temp.ApiConfig origin=null
ARG baseUrl: CALL ‘public final fun getProperty <T> (key: kotlin.String, defaultValue: T of org.koin.core.scope.Scope.getProperty): T of org.koin.core.scope.Scope.getProperty declared in org.koin.core.scope.Scope’ type=T of org.koin.core.scope.Scope.getProperty origin=null
TYPE_ARG T: <none>
ARG <this>: GET_VAR ‘<this>: org.koin.core.scope.Scope declared in com.techullurgy.chessk.temp.ComTechullurgyChesskTempPrivateModuleModuleKt.module$lambda$0$0’ type=org.koin.core.scope.Scope origin=null
ARG key: CONST String type=kotlin.String value=“base_url”
ARG defaultValue: CALL ‘public final fun <get-DEFAULT_URL> (): kotlin.String declared in com.techullurgy.chessk.temp.ApiConfig.Companion’ type=kotlin.String origin=null
at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:57)
at org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate$default(FunctionCodegen.kt:50)
at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethodNode(ClassCodegen.kt:428)
at org.jetbrains.kotlin.backend.jvm.codegen.ClassCodegen.generateMethod(ClassCodegen.kt:445)