square / anvil

A Kotlin compiler plugin to make dependency injection with Dagger 2 easier.
Apache License 2.0
1.29k stars 75 forks source link

Compilation fails with multibindings across separate modules #932

Closed steffandroid closed 3 months ago

steffandroid commented 3 months ago

This is new in v2.5.0-beta04, it was not occurring in beta03.

I'm working with a project which has a couple of "core" library modules, each with two library modules depending on the core – let's call these variant A and variant B. One or both of these variants are compiled into the parent app module depending on the product flavor. All three library modules (core, variant A, variant B) contribute multibinding implementations of an interface in the core module. Each implementation has a MapKey with a String value.

In beta04, the build now fails at the :app:compileVariantADebugJavaWithJavac stage with the following error (I've changed some of the naming to redact certain details):

> Task :app:compileVariantJavaWithJavac FAILED
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:758: error: cannot find symbol
import com.example.lib.Implementation10AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory;
                                               ^
  symbol:   class Implementation10AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: package com.example.lib
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:760: error: cannot find symbol
import com.example.lib.Implementation11AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory;
                                               ^
  symbol:   class Implementation11AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: package com.example.lib
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:762: error: cannot find symbol
import com.example.lib.Implementation12AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory;
                                               ^
  symbol:   class Implementation12AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: package com.example.lib
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:771: error: cannot find symbol
import com.example.lib.Implementation13AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory;
                                               ^
  symbol:   class Implementation13AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: package com.example.lib
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:1300: error: cannot find symbol
import com.example.otherlib.Implementation10AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory;
                                   ^
  symbol:   class Implementation10AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: package com.example.otherlib
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:1301: error: cannot find symbol
import com.example.otherlib.Implementation11AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory;
                                   ^
  symbol:   class Implementation11AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
2024-03-15T00:49:04.0755453Z   location: package com.example.otherlib
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:1302: error: cannot find symbol
import com.example.otherlib.Implementation12AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory;
                                   ^
  symbol:   class Implementation12AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: package com.example.otherlib
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:12576: error: cannot find symbol
      this.mapOfStringAndInterfaceProvider = MapFactory.<String, Interface>builder(13).put("Implementation1", Implementation1AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation2", Implementation2AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation3", Implementation3AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation4", Implementation4AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation5", Implementation5AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation6", Implementation6AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation7", Implementation7AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation8", Implementation8AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation9", Implementation9AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation10", Implementation10AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation11", Implementation11AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation12", Implementation12AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation13", Implementation13AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).build();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ^
  symbol:   variable Implementation10AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: class AppComponentImpl
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:12576: error: cannot find symbol
      this.mapOfStringAndInterfaceProvider = MapFactory.<String, Interface>builder(13).put("Implementation1", Implementation1AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation2", Implementation2AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation3", Implementation3AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation4", Implementation4AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation5", Implementation5AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation6", Implementation6AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation7", Implementation7AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation8", Implementation8AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation9", Implementation9AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation10", Implementation10AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation11", Implementation11AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation12", Implementation12AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation13", Implementation13AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).build();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ^
  symbol:   variable Implementation11AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: class AppComponentImpl
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:12576: error: cannot find symbol
      this.mapOfStringAndInterfaceProvider = MapFactory.<String, Interface>builder(13).put("Implementation1", Implementation1AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation2", Implementation2AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation3", Implementation3AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation4", Implementation4AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation5", Implementation5AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation6", Implementation6AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation7", Implementation7AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation8", Implementation8AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation9", Implementation9AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation10", Implementation10AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation11", Implementation11AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation12", Implementation12AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation13", Implementation13AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).build();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ^
  symbol:   variable Implementation12AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: class AppComponentImpl
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:12576: error: cannot find symbol
      this.mapOfStringAndInterfaceProvider = MapFactory.<String, Interface>builder(13).put("Implementation1", Implementation1AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation2", Implementation2AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation3", Implementation3AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation4", Implementation4AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation5", Implementation5AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation6", Implementation6AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation7", Implementation7AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation8", Implementation8AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation9", Implementation9AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation10", Implementation10AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation11", Implementation11AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation12", Implementation12AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation13", Implementation13AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).build();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ^
  symbol:   variable Implementation13AsComExampleLibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: class AppComponentImpl
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:12630: error: cannot find symbol
      this.mapOfStringAndInterfaceProvider = MapFactory.<String, Interface>builder(12).put("Implementation2", Implementation2AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation3", Implementation3AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation4", Implementation4AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation5", Implementation5AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation5a", Implementation5aAsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation6", Implementation6AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation7", Implementation7AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation8", Implementation8AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation9", Implementation9AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation10", Implementation10AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation11", Implementation11AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation12", Implementation12AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).build();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ^
  symbol:   variable Implementation10AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: class AppComponentImpl
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:12630: error: cannot find symbol
      this.mapOfStringAndInterfaceProvider = MapFactory.<String, Interface>builder(12).put("Implementation2", Implementation2AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation3", Implementation3AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation4", Implementation4AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation5", Implementation5AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation5a", Implementation5aAsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation6", Implementation6AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation7", Implementation7AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation8", Implementation8AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation9", Implementation9AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation10", Implementation10AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation11", Implementation11AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation12", Implementation12AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).build();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ^
  symbol:   variable Implementation11AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: class AppComponentImpl
/app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java:12630: error: cannot find symbol
      this.mapOfStringAndInterfaceProvider = MapFactory.<String, Interface>builder(12).put("Implementation2", Implementation2AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation3", Implementation3AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation4", Implementation4AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation5", Implementation5AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation5a", Implementation5aAsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation6", Implementation6AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation7", Implementation7AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation8", Implementation8AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation9", Implementation9AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation10", Implementation10AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation11", Implementation11AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).put("Implementation12", Implementation12AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory.create()).build();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ^
  symbol:   variable Implementation12AsComExampleOtherlibInterfaceToComExampleDiScopesAppScopeMultiBindingModule_ProvideInterfaceFactory
  location: class AppComponentImpl
Note: /app/build/generated/source/kapt/variant/com/example/DaggerAppComponent.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
14 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileVariantJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

I've attempted to reproduce in a separate project: https://github.com/steffandroid/AnvilBuildError

However with this project I'm running into a different (but perhaps related?) compilation error:

> Task :lib-a:compileKotlin FAILED
e: java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt.checkDecompiledText(org.jetbrains.kotlin.com.intellij.psi.PsiElement)'
    at com.squareup.anvil.compiler.internal.PsiUtilsKt$requireFqName$14.invoke(PsiUtils.kt:373)
    at com.squareup.anvil.compiler.internal.PsiUtilsKt$requireFqName$14.invoke(PsiUtils.kt:258)
    at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:315)
    at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303)
    at com.squareup.anvil.compiler.internal.PsiUtilsKt.requireFqName(PsiUtils.kt:399)
    at com.squareup.anvil.compiler.internal.PsiUtilsKt.requireFqName(PsiUtils.kt:136)
    at com.squareup.anvil.compiler.internal.PsiUtilsKt.requireFqName(PsiUtils.kt:154)
    at com.squareup.anvil.compiler.internal.reference.AnnotationReferenceKt.toAnnotationReference(AnnotationReference.kt:238)
    at com.squareup.anvil.compiler.internal.reference.ClassReference$Psi$annotations$2.invoke(ClassReference.kt:157)
    at com.squareup.anvil.compiler.internal.reference.ClassReference$Psi$annotations$2.invoke(ClassReference.kt:156)
    at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:81)
    at com.squareup.anvil.compiler.internal.reference.ClassReference$Psi.getAnnotations(ClassReference.kt:156)
    at com.squareup.anvil.compiler.internal.reference.AnnotatedReference$DefaultImpls.isAnnotatedWith(AnnotatedReference.kt:14)
    at com.squareup.anvil.compiler.internal.reference.ClassReference.isAnnotatedWith(ClassReference.kt:55)
    at com.squareup.anvil.compiler.codegen.ContributesBindingCodeGen$EmbeddedGenerator$generateCode$1.invoke(ContributesBindingCodeGen.kt:146)
    at com.squareup.anvil.compiler.codegen.ContributesBindingCodeGen$EmbeddedGenerator$generateCode$1.invoke(ContributesBindingCodeGen.kt:146)
    at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:171)
    at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194)
    at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214)
    at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:311)
    at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303)
    at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:809)
    at com.squareup.anvil.compiler.codegen.ContributesBindingCodeGen$EmbeddedGenerator.generateCode(ContributesBindingCodeGen.kt:199)
    at com.squareup.anvil.compiler.codegen.ContributesBindingCodeGen$EmbeddedGenerator.generateCode(ContributesBindingCodeGen.kt:133)
    at com.squareup.anvil.compiler.codegen.CodeGenerationExtension.generateCode$generateCode(CodeGenerationExtension.kt:223)
    at com.squareup.anvil.compiler.codegen.CodeGenerationExtension.generateCode(CodeGenerationExtension.kt:254)
    at com.squareup.anvil.compiler.codegen.CodeGenerationExtension.analysisCompleted(CodeGenerationExtension.kt:138)
    at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:104)
    at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:114)
    at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:88)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:256)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:42)
    at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:115)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:247)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:87)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:47)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:168)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:53)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:100)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:46)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:460)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:62)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.doCompile(IncrementalCompilerRunner.kt:476)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:399)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileNonIncrementally(IncrementalCompilerRunner.kt:280)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:124)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:636)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:101)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1598)
    at jdk.internal.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
    at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
    at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at java.rmi/sun.rmi.transport.Transport.serviceCall(Unknown Source)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

Again, there is no such error in beta03, only beta04.

1gravity commented 3 months ago

Maybe the same issue, maybe not. Our build also fails with beta04 but not beta03. it fails for the task :feature-1:kaptGenerateStubsDebugKotlin' with

e: com.squareup.anvil.compiler.api.AnvilCompilationException: Back-end (JVM) Internal error: Couldn't find the classId for <root>. Are we stuck in a loop while resolving super types? Note that it's not supported to contribute an inner class to a scope that is merged in an outer class.
File is unknown

        at com.squareup.anvil.compiler.api.AnvilCompilationException$Companion.invoke(AnvilCompilationException.kt:84)
        at com.squareup.anvil.compiler.api.AnvilCompilationException$Companion.invoke$default(AnvilCompilationException.kt:79)
        at com.squareup.anvil.compiler.codegen.reference.RealAnvilModuleDescriptor.getClassReference(RealAnvilModuleDescriptor.kt:124)
        at com.squareup.anvil.compiler.internal.reference.ClassReferenceKt.toClassReference(ClassReference.kt:359)
        at com.squareup.anvil.compiler.internal.reference.AnnotationReferenceKt.toAnnotationReference(AnnotationReference.kt:243)
        at com.squareup.anvil.compiler.internal.reference.ClassReference$Descriptor$annotations$2.invoke(ClassReference.kt:273)
        at com.squareup.anvil.compiler.internal.reference.ClassReference$Descriptor$annotations$2.invoke(ClassReference.kt:272)
        at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:81)
        at com.squareup.anvil.compiler.internal.reference.ClassReference$Descriptor.getAnnotations(ClassReference.kt:272)
        at com.squareup.anvil.compiler.InterfaceMerger.addSyntheticSupertypes(InterfaceMerger.kt:39)
        at org.jetbrains.kotlin.resolve.extensions.SyntheticResolveExtension$Companion$getInstance$1.addSyntheticSupertypes(SyntheticResolveExtension.kt:85)
        at org.jetbrains.kotlin.resolve.DescriptorResolver.resolveSupertypes(DescriptorResolver.java:166)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.computeSupertypes(LazyClassDescriptor.java:889)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor$LazyClassTypeConstructor.computeSupertypes(LazyClassDescriptor.java:786)
        at org.jetbrains.kotlin.types.AbstractTypeConstructor$supertypes$1.invoke(AbstractTypeConstructor.kt:78)
        at org.jetbrains.kotlin.types.AbstractTypeConstructor$supertypes$1.invoke(AbstractTypeConstructor.kt:77)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValueWithPostCompute.invoke(LockBasedStorageManager.java:481)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValueWithPostCompute.invoke(LockBasedStorageManager.java:512)
        at org.jetbrains.kotlin.types.AbstractTypeConstructor.getSupertypes(AbstractTypeConstructor.kt:27)
        at org.jetbrains.kotlin.types.AbstractTypeConstructor.getSupertypes(AbstractTypeConstructor.kt:26)
        at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getSuperClassNotAny(DescriptorUtils.kt:152)
        at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getAllSuperclassesWithoutAny(DescriptorUtils.kt:371)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.ClassResolutionScopesSupport$inheritanceScopeWithoutMe$1.invoke(ClassResolutionScopesSupport.kt:50)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.ClassResolutionScopesSupport$inheritanceScopeWithoutMe$1.invoke(ClassResolutionScopesSupport.kt:49)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.ClassResolutionScopesSupport$inheritanceScopeWithMe$1.invoke(ClassResolutionScopesSupport.kt:56)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.ClassResolutionScopesSupport$inheritanceScopeWithMe$1.invoke(ClassResolutionScopesSupport.kt:55)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.ClassResolutionScopesSupport$scopeForMemberDeclarationResolution$1.invoke(ClassResolutionScopesSupport.kt:65)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.ClassResolutionScopesSupport$scopeForMemberDeclarationResolution$1.invoke(ClassResolutionScopesSupport.kt:64)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.getScopeForMemberDeclarationResolution(LazyClassDescriptor.java:446)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.resolveMemberHeaders(LazyClassDescriptor.java:755)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.doForceResolveAllContents(LazyClassDescriptor.java:725)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.lambda$new$4(LazyClassDescriptor.java:222)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.forceResolveAllContents(LazyClassDescriptor.java:721)
        at org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil.doForceResolveAllContents(ForceResolveUtil.java:78)
        at org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil.forceResolveAllContents(ForceResolveUtil.java:42)
        at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension$doAnalysis$1.invoke(PartialAnalysisHandlerExtension.kt:73)
        at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension$doAnalysis$1.invoke(PartialAnalysisHandlerExtension.kt:68)
        at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension.doForEachDeclaration(PartialAnalysisHandlerExtension.kt:126)
        at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension.doForEachDeclaration(PartialAnalysisHandlerExtension.kt:141)
        at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension.doAnalysis(PartialAnalysisHandlerExtension.kt:68)
        at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.doAnalysis(Kapt3Extension.kt:138)
        at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:112)
        at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:77)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:256)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:247)
        at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:115)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:247)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.repeatAnalysisIfNeeded(KotlinToJVMBytecodeCompiler.kt:181)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:87)
        at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:43)
        at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:165)
        at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:50)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:104)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:48)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1523)
        at jdk.internal.reflect.GeneratedMethodAccessor95.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
        at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
        at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
ZacSweers commented 3 months ago

Will need a valid reproducer to debug this, the above isn't enough on its own really :/

steffandroid commented 3 months ago

Closing this as a duplicate of #948.

The multibound implementations in my project are objects, so adding generateDaggerFactories = true has solved the issue.