Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnexpectedException with ksp.useKSP2=true #2036

Open
j-roskopf opened this issue Aug 19, 2024 · 0 comments
Open

UnexpectedException with ksp.useKSP2=true #2036

j-roskopf opened this issue Aug 19, 2024 · 0 comments

Comments

@j-roskopf
Copy link

j-roskopf commented Aug 19, 2024

When enabling ksp.useKSP2=true in my gradle.properties ksp fails for a module in my project. When removing ksp.useKSP2=true, it works as expected.

> Task :navigation-android:kspReleaseKotlin FAILED
e: [ksp] dagger.internal.codegen.base.DaggerSuperficialValidation$ValidationException$UnexpectedException: 
  Validation trace:
    => element (OBJECT): handler.di.NavHandlersModule
    => element (METHOD): provideNavHandlers(java.util.Map<java.lang.Class<?>,handler.NavHandler<?>>)
    => element (PARAMETER): handlers
    => type (DECLARED parameter type): java.util.Map<java.lang.Class<?>,handler.NavHandler<?>>
    => type (DECLARED type argument): java.lang.Class<?>
NavHandlersModule.kt

@Module
@InstallIn(SingletonComponent::class)
object NavHandlersModule {
  @Provides
  @Singleton
  fun provideNavHandlers(
    handlers: @JvmSuppressWildcards Map<Class<*>, NavHandler<*>>
  ): NavHandlers {
    return NavHandlers(handlers)
  }
}
NavHandler.kt

abstract class NavHandler<B : NavBundle> {
  abstract fun handle(bundle: B, host: NavHost, additionalHandlerParams: AdditionalHandlerParams)
}

NavBundle.kt

abstract class NavBundle

data object PhotoBundle : NavBundle()

@Module
@InstallIn(SingletonComponent::class)
interface PhotoNavHandlerModule {
  @Binds
  @IntoMap
  @ClassKey(PhotoBundle::class)
  fun bindPhotoNavHandler(it: PhotoNavHandler): NavHandler<*>
}


ksp version: 2.0.10-1.0.24
kotlin version: 2.0.10

Please let me know if there is any more info I can provide!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant