This can be triggered while using Dagger/Hilt, on
// my-project/features/Foo/impl/src/kotlin/.../FooModule.kt
@InstallIn(SingletonComponent::class)
internal object FooModule {
@Provides
internal fun providesMyDependency(...) = ...
}
Here is the corresponding stacktrace it will generate.
e: [ksp] java.lang.IllegalArgumentException: Can't escape identifier `FooModule_ProvidesMyDependency$my_project_feature_Foo:implFactory` because it contains illegal characters: :
The error goes away when I remove the internal modifier on providesMyDependency.
This appears to be linked with this recent change in Kotlin 2.4.0:
https://kotlinlang.org/docs/whatsnew24.html#consistent-module-names-across-platforms
Prior to Kotlin 2.4.0, default module names differed across platforms. This inconsistency could cause naming conflicts and resolution issues. Kotlin 2.4.0 standardizes the default names to {group}:{project_name} across all platforms.
Manually overriding the moduleName fixes the issue, but I suppose KSP (or dagger, I'm not sure whose responsibility it is) should handle these invalid chars that are now standardized by Kotlin 2.4.0 before using them through kotlinpoet.
This can be triggered while using Dagger/Hilt, on
Here is the corresponding stacktrace it will generate.
The error goes away when I remove the
internalmodifier onprovidesMyDependency.This appears to be linked with this recent change in Kotlin 2.4.0:
Manually overriding the
moduleNamefixes the issue, but I suppose KSP (or dagger, I'm not sure whose responsibility it is) should handle these invalid chars that are now standardized by Kotlin 2.4.0 before using them through kotlinpoet.