Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KSP] java.lang.IllegalStateException #4140

Closed
kemaltunc opened this issue Nov 11, 2023 · 9 comments
Closed

[KSP] java.lang.IllegalStateException #4140

kemaltunc opened this issue Nov 11, 2023 · 9 comments

Comments

@kemaltunc
Copy link

kemaltunc commented Nov 11, 2023

Hi,

#4046

I'm having a similar problem and I thought it would be fixed in version 2.48.1. But the same problem continues.

hilt version:2.48.1

[ksp] java.lang.IllegalStateException: Don't know how to convert element of type 'class dagger.spi.shaded.androidx.room.compiler.processing.ksp.synthetic.KspSyntheticPropertyMethodElement$Setter$SyntheticExecutableParameterElement' to KSP
at dagger.spi.shaded.androidx.room.compiler.processing.compat.XConverters.toKS(XConverters.kt:205)
at dagger.internal.codegen.xprocessing.XElements.isFromJavaSource(XElements.java:393)
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:366)
at dagger.internal.codegen.validation.InjectBindingRegistryImpl.tryRegisterInjectField(InjectBindingRegistryImpl.java:322)
at dagger.internal.codegen.processingstep.InjectProcessingStep.process(InjectProcessingStep.java:75)
at dagger.internal.codegen.processingstep.TypeCheckingProcessingStep.lambda$process$0(TypeCheckingProcessingStep.java:82)
at com.google.common.collect.RegularImmutableMap.forEach(RegularImmutableMap.java:292)
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: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.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.GeneratedMethodAccessor93.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)

@kuanyingchou
Copy link
Collaborator

Hi, @kemaltunc , thanks for reporting. It looks like we didn't fix the bug in XProcessing (we made XElement.getProcessingEnv() enhaustive but not XElement.toKS()). Could you give HEAD-SNAPSHOT a try as we already removed XElements.isFromJavaSource in master?

@kuanyingchou
Copy link
Collaborator

Hi, @kemaltunc , this could happen if the dependencies don't match. Could it be that com.google.dagger:hilt-android hasn't been updated to HEAD-SNAPSHOT?

@kemaltunc
Copy link
Author

Hi, @kuanyingchou This problem continues for me. HEAD-SNAPSHOT did not work for me but I do not have any problems with dagger 2.47 version. Will there be a fix for this in future versions of Dagger?

@kuanyingchou
Copy link
Collaborator

Hi, @kemaltunc , are you still seeing the "No property named assistedFactory was found in annotation HiltViewModel" error above or are you seeing some other error with HEAD-SNAPSHOT?

@kemaltunc
Copy link
Author

kemaltunc commented Nov 13, 2023

@kuanyingchou Yes, I still see the error "No property named assistedFactory was found in annotation HiltViewModel" with HEAD-SNAPSHOT. Thank you for support.

hilt = "HEAD-SNAPSHOT"
hiltCompiler = "1.1.0"
hiltWork = "1.1.0"

hilt = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
hiltAndroidCompiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" }
hiltCompiler = { group = "androidx.hilt", name = "hilt-compiler", version.ref = "hiltCompiler" }
hiltWorkManager = { group = "androidx.hilt", name = "hilt-work", version.ref = "hiltWork" }

@kuanyingchou
Copy link
Collaborator

Thanks for the version config. Has the Hilt Gradle Plugin also changed to HEAD-SNAPSHOT?

plugins {
  ...
  id("com.google.dagger.hilt.android") version "HEAD-SNAPSHOT" apply false
}

You may also need to ensure nothing is using the old version with the config here: #3401 (comment)

@kemaltunc
Copy link
Author

kemaltunc commented Nov 13, 2023

 configurations.all { 
    resolutionStrategy.eachDependency {
        if (requested.group == "com.google.dagger") {
            useVersion("HEAD-SNAPSHOT")
        }
    }
}

I forgot to add for some modules. Now I can run it without any problems with the HEAD-SNAPSHOT version. Now I have to wait for the stable version. Thank you for your support

@kemaltunc
Copy link
Author

@kuanyingchou Is the release date known?

@kuanyingchou
Copy link
Collaborator

Hi, @kemaltunc , I think it should happen sometime next week: #4096 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants