koin-annotations icon indicating copy to clipboard operation
koin-annotations copied to clipboard

Inject Generic Parameters Still Breaking

Open lockhartja opened this issue 9 months ago • 1 comments

Describe the bug Continuation of bug https://github.com/InsertKoinIO/koin-annotations/issues/240

When using star projection generics, bug as reported in 240 reproduces:

To Reproduce

Definition: @Scope(name = TASK_REQUEST_SCOPE) @Scoped(binds = [IDTaskRunnerSvc::class]) fun loadTaskRunnerService( @InjectedParam diScope: org.koin.core.scope.Scope, @InjectedParam reqId: URequestId, @InjectedParam taskDef: IUTaskUow<*,*>, @InjectedParam ctxTokens: Set<IUTaskToken>, ): IDTaskRunnerSvc = DTaskRunnerSvc( taskDiScope = diScope, requestId = reqId, taskDefinition = taskDef, taskCtxTokens = ctxTokens, )

Generated Code scope(org.koin.core.qualifier.StringQualifier("scoped_deps__task_req")) { scoped() { (diScope : org.koin.core.scope.Scope,reqId : dbaas.universal.model.domain.URequestId,taskDef : dbaas.universal.contract.IUTaskUow<>,ctxTokens : kotlin.collections.Set<dbaas.universal.contract.IUTaskToken>) -> moduleInstance.loadTaskRunnerService(diScope,reqId,taskDef,ctxTokens) } bind(daemon.web.contract.IDTaskRunnerSvc::class) }

Compiler error: Destructuring of type 'org.koin.core.parameter.ParametersHolder' requires operator function 'component3()'.

Expected behavior When the generics are removed the compiler is once again happy -- would love to keep it happy

Koin project used and used version (please complete the following information): [e.g]: koin-core version 4.0.4, annotations: 2.0.1-RC1

Additional moduleDefinition Add any other moduleDefinition about the problem here.

lockhartja avatar May 13 '25 00:05 lockhartja

You are combining injected parameters here. Does it reproduce with only one param?

arnaudgiuliani avatar Jun 10 '25 14:06 arnaudgiuliani

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 07 '25 18:11 stale[bot]