Assigned
Status Update
Comments
da...@google.com <da...@google.com> #2
Do let me know if you need a sample app that reproduces the issue.
le...@google.com <le...@google.com>
da...@google.com <da...@google.com> #3
I also wanted to add that simply ignoring the unresolved type is not as easy as you'd expect. Dagger and many other processors rely on multiple rounds for coordination, so when Dagger sees an unresolved type he thinks 'hey, maybe this has not been generated yet', so he differs processing elements until another round in hopes of another processor generating the missing type. Sometime he can't tell if the annotation is important or not, if Dagger can't resolve it, he can't read its meta-annotations. Once its the last round, then Dagger fails. This same strategy applies to KSP too.
sa...@gmail.com <sa...@gmail.com> #4
Have the same issue in our project, dagger fails to compile
> Task :appivi:kaptMobileDebugKotlin FAILED
error: ComponentProcessingStep was unable to process 'ru.ivi.client.screens.di.ScreenPresenterComponent' because 'androidx.compose.runtime.internal.StabilityInferred' could not be resolved.
Dependency trace:
=> element (CLASS): ru.ivi.client.arch.interactor.SafeShowAdultContentInteractor
=> annotation: @androidx.compose.runtime.internal.StabilityInferred(parameters = 0)
=> type (ERROR annotation type): androidx.compose.runtime.internal.StabilityInferred
If type 'androidx.compose.runtime.internal.StabilityInferred' is a generated type, check above for compilation errors that may have prevented the type from being generated. Otherwise, ensure that type 'androidx.compose.runtime.internal.StabilityInferred' is on your classpath.
FAILURE: Build failed with an exception.
Description
Jetpack Compose release version: 1.1.0-beta01
The
@StabilityInferred
seems to be placed on public classes forcing the library to declare anapi
dependency incompose-runtime
or risk running into issue due toStabilityInferred
being missed in the classpath.Consider the following:
A library 'lib' that exposes a View whose implementation is in Compose will declare an
implementation
dep tocompose-runtime
. The consuming 'app' then uses 'lib' and runs some annotation processor. If the processor, via the AST visits the exposed View and reads it's class annotations, it will encounter error / unresolved type due to@StabilityInferred
not being in the compile classpath of 'app' due to Gradle reducing the compile classpath between module boundaries (app
->lib
->compose-runtime
).This was reported in Dagger here:https://github.com/google/dagger/issues/3090#issuecomment-988245465
Note that even though a workaround is to add a dep to
compose-runtime
in 'app' or declare it asapi
in 'lib', the solution will affect compilation times due to increased classpath. The user also has no way of knowing the Kotlin compiler is exposing types in the user's public API making it harder for them to reason about the workaround.