evant / kotlin-inject-samples

Verious samples using kotlin-inject
Apache License 2.0
19 stars 5 forks source link

Reproduce error when two components have a cyclic dependency #4

Closed saket closed 2 years ago

saket commented 3 years ago

Context: https://kotlinlang.slack.com/archives/C0255B8KX7W/p1635740641018000

e: [ksp] Cannot find an @Inject constructor or provider for: String
/Users/saket/projects/kotlin-inject-samples/multiplatform/echo/src/commonMain/kotlin/App.kt:23: StringConsumer(string: String)
/Users/saket/projects/kotlin-inject-samples/multiplatform/echo/src/commonMain/kotlin/App.kt:19: stringConsumer: StringConsumer
e: java.lang.IllegalStateException: No descriptor found for type alias Args
        at org.jetbrains.kotlin.cli.metadata.MetadataSerializer$performSerialization$1.visitTypeAlias(MetadataSerializer.kt:86)
        at org.jetbrains.kotlin.psi.KtVisitorVoid.visitTypeAlias(KtVisitorVoid.java:499)
        at org.jetbrains.kotlin.psi.KtVisitorVoid.visitTypeAlias(KtVisitorVoid.java:21)
        at org.jetbrains.kotlin.psi.KtTypeAlias.accept(KtTypeAlias.kt:35)
        at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)
        at org.jetbrains.kotlin.cli.metadata.MetadataSerializer.performSerialization(MetadataSerializer.kt:68)
        at org.jetbrains.kotlin.cli.metadata.MetadataSerializer.serialize(MetadataSerializer.kt:55)
        at org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:117)
        at org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:40)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:92)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1618)
glureau commented 2 years ago

Experienced the same root exception in another project when using KSP and annotation on "type alias", code is generated but then the compilation fails.

Could it be a 1.6 kotlin issue?

e: java.lang.IllegalStateException: No descriptor found for type alias com.deezer.kmp.api.QueueListUpdatedEventArgsPP
        at org.jetbrains.kotlin.cli.metadata.MetadataSerializer$performSerialization$1.visitTypeAlias(MetadataSerializer.kt:86)
        at org.jetbrains.kotlin.psi.KtVisitorVoid.visitTypeAlias(KtVisitorVoid.java:499)
        at org.jetbrains.kotlin.psi.KtVisitorVoid.visitTypeAlias(KtVisitorVoid.java:21)
        at org.jetbrains.kotlin.psi.KtTypeAlias.accept(KtTypeAlias.kt:35)
        at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49)
        at org.jetbrains.kotlin.cli.metadata.MetadataSerializer.performSerialization(MetadataSerializer.kt:68)
        at org.jetbrains.kotlin.cli.metadata.MetadataSerializer.serialize(MetadataSerializer.kt:55)
        at org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:117)
        at org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:40)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:92)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1618)
        at sun.reflect.GeneratedMethodAccessor110.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
        at sun.rmi.transport.Transport$1.run(Transport.java:200)
        at sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)