You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that after #1042, overridden abstract functions are being miscounted in regards to subcomponent factory interfaces, despite being the same function. Consider the following configuration:
This works as expected on 2.5.0-beta09 but if you try to compile this on 2.5.0-beta10, you get:
e: com.squareup.anvil.compiler.api.AnvilCompilationException: Back-end (JVM) Internal error: A factory must have exactly one abstract function returning the subcomponent com.squareup.test.SubcomponentInterface
File being compiled: (09,12) in Example.kt
at com.squareup.anvil.compiler.internal.reference.ClassReferenceKt.AnvilCompilationExceptionClassReference(ClassReference.kt:553)
at com.squareup.anvil.compiler.internal.reference.ClassReferenceKt.AnvilCompilationExceptionClassReference$default(ClassReference.kt:548)
at com.squareup.anvil.compiler.codegen.ContributesSubcomponentCodeGen$Embedded.checkFactory(ContributesSubcomponentCodeGen.kt:390)
at com.squareup.anvil.compiler.codegen.ContributesSubcomponentCodeGen$Embedded.access$checkFactory(ContributesSubcomponentCodeGen.kt:244)
at com.squareup.anvil.compiler.codegen.ContributesSubcomponentCodeGen$Embedded$generateCode$3.invoke(ContributesSubcomponentCodeGen.kt:285)
at com.squareup.anvil.compiler.codegen.ContributesSubcomponentCodeGen$Embedded$generateCode$3.invoke(ContributesSubcomponentCodeGen.kt:284)
at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210)
at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:811)
at com.squareup.anvil.compiler.codegen.ContributesSubcomponentCodeGen$Embedded.generateCode(ContributesSubcomponentCodeGen.kt:303)
at com.squareup.anvil.compiler.codegen.CodeGenerationExtension.generateCode$generateAndCache(CodeGenerationExtension.kt:229)
at com.squareup.anvil.compiler.codegen.CodeGenerationExtension.generateCode$loopGeneration(CodeGenerationExtension.kt:255)
at com.squareup.anvil.compiler.codegen.CodeGenerationExtension.generateCode(CodeGenerationExtension.kt:266)
at com.squareup.anvil.compiler.codegen.CodeGenerationExtension.analysisCompleted(CodeGenerationExtension.kt:121)
The text was updated successfully, but these errors were encountered:
jonamireh
changed the title
ContributesSubcomponent.Factory validation fails when the function is inherited and overridden
ContributesSubcomponent.Factory validation fails when the function is overridden
Jul 30, 2024
It appears that after #1042, overridden abstract functions are being miscounted in regards to subcomponent factory interfaces, despite being the same function. Consider the following configuration:
This works as expected on 2.5.0-beta09 but if you try to compile this on 2.5.0-beta10, you get:
The text was updated successfully, but these errors were encountered: