ralf
09/13/2024, 4:22 PMevant
09/13/2024, 6:11 PMZac Sweers
09/15/2024, 3:40 AMJosh Feinberg
09/17/2024, 3:55 AMkotlin-inject-anvil
and now i'm getting a FileAlreadyExistsException
. best way to debug this?Marko Novaković
09/19/2024, 11:54 AMkotlin-inject
+ kotlin-inject-anvil
and my component is interface ApplicationComponent : ApplicationComponentMerged
which is fine. ApplicationComponentMerged
is generated but ApplicationComponent
can’t access things provided by components that ApplicationComponentMerged
extends/inheritsJohn O'Reilly
10/03/2024, 4:16 PMe: [ksp] @Provides method must have a concrete implementation
e: Error occurred in KSP, check log for detail
ralf
10/23/2024, 9:37 PMe: [ksp] java.lang.IllegalArgumentException: Error type '<ERROR TYPE>' is not resolvable in the current round of processing.
at com.squareup.kotlinpoet.ksp.KsTypesKt.requireNotErrorType(KsTypes.kt:40)
at com.squareup.kotlinpoet.ksp.KsTypesKt.toTypeName(KsTypes.kt:71)
at com.squareup.kotlinpoet.ksp.KsTypesKt.toTypeName(KsTypes.kt:199)
at com.squareup.kotlinpoet.ksp.KsTypesKt.toTypeName(KsTypes.kt:196)
at com.squareup.kotlinpoet.ksp.KsTypesKt.toTypeName$default(KsTypes.kt:187)
at me.tatarka.kotlin.ast.KSAstType.toTypeName(KSAst.kt:555)
at me.tatarka.kotlin.ast.AstParam.toParameterSpec(Ast.kt:269)
at me.tatarka.inject.compiler.InjectGenerator.generateInjectComponent(InjectGenerator.kt:118)
at me.tatarka.inject.compiler.InjectGenerator.generate(InjectGenerator.kt:68)
at me.tatarka.inject.compiler.ksp.ProcessInjectKt.process(ProcessInject.kt:80)
at me.tatarka.inject.compiler.ksp.ProcessInjectKt.processInject(ProcessInject.kt:28)
at me.tatarka.inject.compiler.ksp.ProcessInjectKt.processInject$default(ProcessInject.kt:19)
at me.tatarka.inject.compiler.ksp.InjectProcessor.process$lambda$1(InjectProcessor.kt:55)
It’s likely that an api
vs implementation
dependency was misused. Is there an easy way to find out where this happens? E.g. print the fileralf
10/23/2024, 11:02 PMJohn O'Reilly
10/24/2024, 3:13 PMWorkerFactory
...but had wondered if maybe something similar to @HiltWorker
?Daniel Weidensdörfer
11/02/2024, 10:42 AMralf
11/02/2024, 11:14 PMDaniel Weidensdörfer
11/08/2024, 11:01 AMralf
11/08/2024, 9:02 PMDaniel Weidensdörfer
11/08/2024, 9:15 PMDaniel Weidensdörfer
11/08/2024, 9:55 PMJosh Feinberg
11/12/2024, 3:55 AMKirill Zhukov
11/25/2024, 11:10 PMkotlin-inject-anvil
, should I expect FeatureFlagService
and FeatureFlagSyncWorker
to be singletons here?
@Origin(value = FeatureFlagServiceImpl::class)
@ContributesTo(scope = AppScope::class)
public interface FeatureFlagServiceImplComponent {
@Provides
@SingleIn(scope = AppScope::class)
public fun provideFeatureFlagService(implementation: FeatureFlagServiceImpl): FeatureFlagService = implementation
@Provides
@SingleIn(scope = AppScope::class)
public fun provideFeatureFlagSyncWorker(implementation: FeatureFlagServiceImpl): FeatureFlagSyncWorker = implementation
}
John O'Reilly
12/22/2024, 10:22 AMkotlin-inject-anvil
and just struggling a little with createComponent
etc plumbing. I have per platform application components and can't do likes of following in those (expect function needs to be in commonMain
). Are there any examples on how to setup something like this?
@MergeComponent.CreateComponent
expect fun KClass<DesktopApplicationComponent>.createComponent(): DesktopApplicationComponent
Daniel Weidensdörfer
12/23/2024, 2:20 PMparth
01/01/2025, 7:01 PM@Provides
methods need to be wrapped in a @Component
, else they don’t get picked up.
e.g.
//in file network.kt
@Provides
fun provideOkhttpClient(): OkHttpClient {
return OkHttpClient.Builder().build()
}
this won’t work, it needs to be
@ContributesTo(AppScope::class) //k-i-anvil annotation
interface NetworkComponent {
@Provides fun okhttp(): OkHttpClient { ... }
}
FR: could be cool to allow @Provides
on toplevel functions without a Component wrapper. Or have something in the docs for Dagger converts that says “use @Component
like Dagger uses `@Module`”ursus
01/24/2025, 2:07 AMKonstantin Tskhovrebov
02/09/2025, 6:56 PMdave08
02/11/2025, 2:02 PMdorche
02/25/2025, 2:28 PMinternal
visibility modifier but I'm running into some issues. Details in threadAndré Thiele
03/04/2025, 3:21 PMeygraber
03/13/2025, 4:11 AMComponent
as a child of a kotlin-inject-anvil ContributesSubcomponent
? I tried doing this and it can't find any dependencies from the ancestor graphs.ralf
04/17/2025, 5:57 AMCaused by: ksp.org.jetbrains.kotlin.analysis.api.lifetime.KaInvalidLifetimeOwnerAccessException: Access to invalid ksp.org.jetbrains.kotlin.analysis.api.platform.lifetime.KotlinAlwaysAccessibleLifetimeToken@33adf999: PSI has changed since creation
at ksp.org.jetbrains.kotlin.analysis.api.fir.symbols.KaFirNamedFunctionSymbol.getPsi(KaFirNamedFunctionSymbol.kt:247)
at com.google.devtools.ksp.impl.symbol.kotlin.UtilKt.toContainingFile(util.kt:237)
at com.google.devtools.ksp.impl.symbol.kotlin.AbstractKSDeclarationImpl$containingFile$2.invoke(AbstractKSDeclarationImpl.kt:79)
at com.google.devtools.ksp.impl.symbol.kotlin.AbstractKSDeclarationImpl$containingFile$2.invoke(AbstractKSDeclarationImpl.kt:78)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:83)
at com.google.devtools.ksp.impl.symbol.kotlin.AbstractKSDeclarationImpl.getContainingFile(AbstractKSDeclarationImpl.kt:78)
at me.tatarka.kotlin.ast.KSAstProvider.addOriginatingElement(KSAst.kt:94)
at me.tatarka.inject.compiler.KmpComponentCreateGenerator.generate(KmpComponentCreateGenerator.kt:27)
at me.tatarka.inject.compiler.ksp.ProcessKmpComponentCreateKt.generateKmpComponentCreateFiles(ProcessKmpComponentCreate.kt:40)
at me.tatarka.inject.compiler.ksp.InjectProcessor.finish(InjectProcessor.kt:113)
I can reproduce this consistently in unit tests for all platforms where I define the function in commonTest
@KmpComponentCreate
expect fun createTestComponent(
coroutineScope: CoroutineScope,
coroutineDispatcher: CoroutineDispatcher,
): TestComponent
This happens only with KSP 2, there’s no issue with KSP 1 obviously.Alexandre Gressier
04/17/2025, 1:02 PMPablichjenkov
04/24/2025, 7:58 PMJosh Feinberg
04/30/2025, 3:52 AM