Zac Sweers
05/28/2025, 9:08 PMinterface ExampleGraph
, which extends some other generated class Contribution
. This supertype is generated during FIR as well
@DependencyGraph(AppScope::class)
interface ExampleGraph : Impl.Contribution
// another file
@Inject
@ContributesBinding(AppScope::class)
class Impl : Base {
// Generated in FIR
interface Contribution {
@Binds fun Impl.bindImplAsBase(): Base
}
}
My checker checks that Contribution
has a compatible visibility with ExampleGraph
, as I want to give a more meaningful error message where possible than the standard compiler error message that would happen. However, a user reported that in an incremental compilation scenario where Impl
is changed to internal
(and thus incompatible, the public
ExampleGraph would extend an internal
type) but only the Impl
file is ever passed to the checker. As a result, the issue escapes it since ExampleGraph
is not passed to the checker again.
Is this expected? It surprised me because I would expect a changed visibility of a class's supertype to trigger recompilation or at least FIR checks.
I tried explicitly copying the visibility
of the parent when generating the nested Contribution
class just in case but alas no dice. We do generate a function during IR that we make visible to metadata that helps us avoid some IC issues, but since it's IR-only it's too late in the pipeline to helpZac Sweers
05/29/2025, 1:38 PMinterface Base
internal class Impl : Base {
internal interface Contribution
}
class Graph : Impl.Contribution
Whereas this would be an error
class Graph(
val contribution: Impl.Contribution
) : Impl.Contribution
Zac Sweers
05/29/2025, 1:42 PM