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
Hi, I've encountered a bug in a multi-module project with Room 2.4.0 and KSP version 1.6.10-1.0.2. Is this a problem on the KSP or Room side?
Stacktrace
e: java.lang.IllegalStateException: failed to analyze: java.lang.ClassCastException: class com.google.devtools.ksp.symbol.impl.kotlin.KSErrorType cannot be cast to class com.google.devtools.ksp.symbol.impl.kotlin.KSTypeImpl (com.google.devtools.ksp.symbol.impl.kotlin.KSErrorType and com.google.devtools.ksp.symbol.impl.kotlin.KSTypeImpl are in unnamed module of loader java.net.URLClassLoader @201b740a)
at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:56)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:105)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:58)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:170)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
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 jdk.internal.reflect.GeneratedMethodAccessor193.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
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(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassCastException: class com.google.devtools.ksp.symbol.impl.kotlin.KSErrorType cannot be cast to class com.google.devtools.ksp.symbol.impl.kotlin.KSTypeImpl (com.google.devtools.ksp.symbol.impl.kotlin.KSErrorType and com.google.devtools.ksp.symbol.impl.kotlin.KSTypeImpl are in unnamed module of loader java.net.URLClassLoader @201b740a)
at com.google.devtools.ksp.symbol.impl.UtilsKt.toKotlinType(utils.kt:351)
at com.google.devtools.ksp.symbol.impl.UtilsKt.replaceTypeArguments(utils.kt:369)
at com.google.devtools.ksp.symbol.impl.kotlin.KSTypeImpl.replace(KSTypeImpl.kt:94)
at androidx.room.compiler.processing.ksp.KSTypeVarianceResolver.inheritVariance(KSTypeVarianceResolver.kt:87)
at androidx.room.compiler.processing.ksp.KSTypeVarianceResolver.applyTypeVariance(KSTypeVarianceResolver.kt:53)
at androidx.room.compiler.processing.ksp.KspProcessingEnv.resolveWildcards(KspProcessingEnv.kt:275)
at androidx.room.compiler.processing.ksp.KspJvmTypeResolver.resolveJvmType$room_compiler_processing(KspJvmTypeResolver.kt:48)
at androidx.room.compiler.processing.ksp.KspType$typeName$2.invoke(KspType.kt:52)
at androidx.room.compiler.processing.ksp.KspType$typeName$2.invoke(KspType.kt:51)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at androidx.room.compiler.processing.ksp.KspType.getTypeName(KspType.kt:51)
at androidx.room.processor.CustomConverterProcessor.processMethod(CustomConverterProcessor.kt:173)
at androidx.room.processor.CustomConverterProcessor.process(CustomConverterProcessor.kt:135)
at androidx.room.processor.CustomConverterProcessor$Companion.findConverters(CustomConverterProcessor.kt:67)
at androidx.room.processor.Context.fork(Context.kt:155)
at androidx.room.processor.Context.fork$default(Context.kt:153)
at androidx.room.processor.DatabaseProcessor.(DatabaseProcessor.kt:50)
at androidx.room.DatabaseProcessingStep$process$databases$1$1.invoke(DatabaseProcessingStep.kt:71)
at androidx.room.DatabaseProcessingStep$process$databases$1$1.invoke(DatabaseProcessingStep.kt:70)
at androidx.room.processor.Context.collectLogs(Context.kt:149)
at androidx.room.DatabaseProcessingStep.process(DatabaseProcessingStep.kt:70)
at androidx.room.DatabaseProcessingStep.process(DatabaseProcessingStep.kt:41)
at androidx.room.compiler.processing.CommonProcessorDelegate.processRound(XBasicAnnotationProcessor.kt:114)
at androidx.room.compiler.processing.ksp.KspBasicAnnotationProcessor.process(KspBasicAnnotationProcessor.kt:61)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$4$1.invoke(KotlinSymbolProcessingExtension.kt:195)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$4$1.invoke(KotlinSymbolProcessingExtension.kt:193)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:287)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:193)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:120)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:262)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:53)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:113)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:253)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.repeatAnalysisIfNeeded(KotlinToJVMBytecodeCompiler.kt:223)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:100)
... 23 more
The text was updated successfully, but these errors were encountered:
The exception is thrown because of a miss in error handling in KSP, where KSType.replace() doesn't handle the case where some of the new type arguments are unknown / cannot be resolved.
We'll fix it by adding corresponding error handling logic, so that KSType.replace() will return an error type, instead of throwing an exception like that.
On the other hand, before the fix reaches next KSP release, it might be possible to avoid this error by finding out the unknown type and, if it was not intended, replace it with the desired type.
Hi, I've encountered a bug in a multi-module project with Room 2.4.0 and KSP version 1.6.10-1.0.2. Is this a problem on the KSP or Room side?
Stacktrace
e: java.lang.IllegalStateException: failed to analyze: java.lang.ClassCastException: class com.google.devtools.ksp.symbol.impl.kotlin.KSErrorType cannot be cast to class com.google.devtools.ksp.symbol.impl.kotlin.KSTypeImpl (com.google.devtools.ksp.symbol.impl.kotlin.KSErrorType and com.google.devtools.ksp.symbol.impl.kotlin.KSTypeImpl are in unnamed module of loader java.net.URLClassLoader @201b740a)
at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:56)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:105)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:58)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:170)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
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 jdk.internal.reflect.GeneratedMethodAccessor193.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
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(Native Method)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassCastException: class com.google.devtools.ksp.symbol.impl.kotlin.KSErrorType cannot be cast to class com.google.devtools.ksp.symbol.impl.kotlin.KSTypeImpl (com.google.devtools.ksp.symbol.impl.kotlin.KSErrorType and com.google.devtools.ksp.symbol.impl.kotlin.KSTypeImpl are in unnamed module of loader java.net.URLClassLoader @201b740a)
at com.google.devtools.ksp.symbol.impl.UtilsKt.toKotlinType(utils.kt:351)
at com.google.devtools.ksp.symbol.impl.UtilsKt.replaceTypeArguments(utils.kt:369)
at com.google.devtools.ksp.symbol.impl.kotlin.KSTypeImpl.replace(KSTypeImpl.kt:94)
at androidx.room.compiler.processing.ksp.KSTypeVarianceResolver.inheritVariance(KSTypeVarianceResolver.kt:87)
at androidx.room.compiler.processing.ksp.KSTypeVarianceResolver.applyTypeVariance(KSTypeVarianceResolver.kt:53)
at androidx.room.compiler.processing.ksp.KspProcessingEnv.resolveWildcards(KspProcessingEnv.kt:275)
at androidx.room.compiler.processing.ksp.KspJvmTypeResolver.resolveJvmType$room_compiler_processing(KspJvmTypeResolver.kt:48)
at androidx.room.compiler.processing.ksp.KspType$typeName$2.invoke(KspType.kt:52)
at androidx.room.compiler.processing.ksp.KspType$typeName$2.invoke(KspType.kt:51)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at androidx.room.compiler.processing.ksp.KspType.getTypeName(KspType.kt:51)
at androidx.room.processor.CustomConverterProcessor.processMethod(CustomConverterProcessor.kt:173)
at androidx.room.processor.CustomConverterProcessor.process(CustomConverterProcessor.kt:135)
at androidx.room.processor.CustomConverterProcessor$Companion.findConverters(CustomConverterProcessor.kt:67)
at androidx.room.processor.Context.fork(Context.kt:155)
at androidx.room.processor.Context.fork$default(Context.kt:153)
at androidx.room.processor.DatabaseProcessor.(DatabaseProcessor.kt:50)
at androidx.room.DatabaseProcessingStep$process$databases$1$1.invoke(DatabaseProcessingStep.kt:71)
at androidx.room.DatabaseProcessingStep$process$databases$1$1.invoke(DatabaseProcessingStep.kt:70)
at androidx.room.processor.Context.collectLogs(Context.kt:149)
at androidx.room.DatabaseProcessingStep.process(DatabaseProcessingStep.kt:70)
at androidx.room.DatabaseProcessingStep.process(DatabaseProcessingStep.kt:41)
at androidx.room.compiler.processing.CommonProcessorDelegate.processRound(XBasicAnnotationProcessor.kt:114)
at androidx.room.compiler.processing.ksp.KspBasicAnnotationProcessor.process(KspBasicAnnotationProcessor.kt:61)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$4$1.invoke(KotlinSymbolProcessingExtension.kt:195)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$4$1.invoke(KotlinSymbolProcessingExtension.kt:193)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:287)
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:193)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:120)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:262)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:53)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:113)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:253)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.repeatAnalysisIfNeeded(KotlinToJVMBytecodeCompiler.kt:223)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:100)
... 23 more
The text was updated successfully, but these errors were encountered: