dagger: [KSP] java.lang.IllegalStateException: Unexpected element

I’ve encountered the following issues, and what’s intriguing is that my project doesn’t involve the use of any Room compiler or similar components.

[ksp] java.lang.IllegalStateException: Unexpected element: dagger.spi.shaded.androidx.room.compiler.processing.ksp.synthetic.KspSyntheticPropertyMethodElement$Setter$SyntheticExecutableParameterElement@f29df7f
	at dagger.spi.shaded.androidx.room.compiler.processing.compat.XConverters.getProcessingEnv(XConverters.kt:285)
	at dagger.internal.codegen.xprocessing.XElements.isFromJavaSource(XElements.java:389)
	at dagger.internal.codegen.binding.Nullability.isKotlinTypeNullable(Nullability.java:65)
	at dagger.internal.codegen.binding.Nullability.of(Nullability.java:52)
	at dagger.internal.codegen.binding.DependencyRequestFactory.newDependencyRequest(DependencyRequestFactory.java:228)
	at dagger.internal.codegen.binding.DependencyRequestFactory.forRequiredResolvedVariable(DependencyRequestFactory.java:139)
	at dagger.internal.codegen.binding.DependencyRequestFactory.forRequiredResolvedVariables(DependencyRequestFactory.java:76)
	at dagger.internal.codegen.binding.InjectionSiteFactory$InjectionSiteVisitor.visitMethod(InjectionSiteFactory.java:122)
	at dagger.internal.codegen.binding.InjectionSiteFactory$InjectionSiteVisitor.visit(InjectionSiteFactory.java:96)
	at dagger.internal.codegen.binding.InjectionSiteFactory.getInjectionSites(InjectionSiteFactory.java:73)
	at dagger.internal.codegen.binding.BindingFactory.membersInjectionBinding(BindingFactory.java:518)
	at dagger.internal.codegen.validation.InjectBindingRegistryImpl.tryRegisterMembersInjectedType(InjectBindingRegistryImpl.java:318)
	at dagger.internal.codegen.validation.InjectBindingRegistryImpl.tryRegisterInjectMethod(InjectBindingRegistryImpl.java:297)
	at dagger.internal.codegen.processingstep.InjectProcessingStep.process(InjectProcessingStep.java:77)
	at dagger.internal.codegen.processingstep.TypeCheckingProcessingStep.lambda$process$0(TypeCheckingProcessingStep.java:82)
	at com.google.common.collect.SingletonImmutableBiMap.forEach(SingletonImmutableBiMap.java:68)
	at dagger.internal.codegen.processingstep.TypeCheckingProcessingStep.process(TypeCheckingProcessingStep.java:70)
	at dagger.internal.codegen.processingstep.TypeCheckingProcessingStep.process(TypeCheckingProcessingStep.java:48)
	at dagger.spi.shaded.androidx.room.compiler.processing.XProcessingStep.process(XProcessingStep.kt:59)
	at dagger.spi.shaded.androidx.room.compiler.processing.CommonProcessorDelegate.processRound(XBasicAnnotationProcessor.kt:130)
	at dagger.spi.shaded.androidx.room.compiler.processing.ksp.KspBasicAnnotationProcessor.process(KspBasicAnnotationProcessor.kt:62)
	at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$8$1.invoke(KotlinSymbolProcessingExtension.kt:305)
	at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$8$1.invoke(KotlinSymbolProcessingExtension.kt:303)
	at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:409)
	at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:303)
	at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:112)
	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.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1497)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.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)

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 5
  • Comments: 15

Commits related to this issue

Most upvoted comments

I guess this has not been released yet if yes when is next release planned ?

I’m no longer facing this compilation crash ! Thanks @kuanyingchou !

But I’m facing a new one 😕 I’ll create a new github issue to report it

@kuanyingchou Tell me when it’s done, I can try snapshot releases my repo easily

Okay, the updated XProcessing jars have been dropped into Dagger so I’m going to close this.

The changes should be available in the HEAD-SNAPSHOT artifacts, and will be included in the next official Dagger release.

Hi i have fixed the issue by finding the root cause , we had 3 project but 2 of them does not have nay issue implementing latest 2.48 and it was one specific code that cause this error in one project

It was an annotation in our code

"@set:Inject "

when i removed it was no more referencing to room compiler error , i am not sure why it was happening but removing that solved my issue

@paladin952 your code also might have something like this, i found out this by removing module by module and narrowed down to file and specific set of code

Thank you @bcorso for the prompt

❤️ thanks a lot! you are right. I had one instance of @set:inject … Removing that fixes the issues.

Thank you a lot!

Hi i have fixed the issue by finding the root cause , we had 3 project but 2 of them does not have nay issue implementing latest 2.48 and it was one specific code that cause this error in one project

It was an annotation in our code

"@set:Inject "

when i removed it was no more referencing to room compiler error , i am not sure why it was happening but removing that solved my issue

@paladin952 your code also might have something like this, i found out this by removing module by module and narrowed down to file and specific set of code

Thank you @bcorso for the prompt

Thanks for trying it out and reporting back. Looks like the issues is that we haven’t drop the new XProcessing jars into Dagger. That should be done once https://github.com/google/dagger/pull/4077 is submitted (probably on Monday).

I guess this has not been released yet if yes when is next release planned ?

We’re still hoping to get fixes for a few more issues in before doing another release (particularly, the incremental processing issues in #4063, #4060, #4054). Also, FYI, if you’re really itching to get this fix you can always check out the HEAD-SNAPSHOT artifacts until the next official release is out.

Thanks for reporting. This looks like a bug in Room’s XProcessing, a library Dagger uses for KSP migration. I’ll include a fix in the next version.