Has anyone seen this failure? I feel like I must b...
# compose-destinations
j
Has anyone seen this failure? I feel like I must be doing something wrong
Copy code
> Task :androidApp:kspDevDebugKotlin
e: [ksp] java.lang.NullPointerException
	at com.ramcosta.composedestinations.codegen.writers.ModuleRegistryWriter.write$lambda$3(ModuleRegistryWriter.kt:98)
	at kotlin.text.StringsKt__AppendableKt.appendElement(Appendable.kt:84)
	at kotlin.collections.CollectionsKt___CollectionsKt.joinTo(_Collections.kt:3493)
	at kotlin.collections.CollectionsKt___CollectionsKt.joinToString(_Collections.kt:3510)
	at kotlin.collections.CollectionsKt___CollectionsKt.joinToString$default(_Collections.kt:3509)
	at com.ramcosta.composedestinations.codegen.writers.ModuleRegistryWriter.write(ModuleRegistryWriter.kt:93)
	at com.ramcosta.composedestinations.codegen.writers.ModuleOutputWriter.write(ModuleOutputWriter.kt:41)
	at com.ramcosta.composedestinations.codegen.CodeGenerator.postValidateGenerate(CodeGenerator.kt:90)
	at com.ramcosta.composedestinations.codegen.CodeGenerator.generate(CodeGenerator.kt:73)
	at com.ramcosta.composedestinations.ksp.processors.Processor.process(Processor.kt:87)
	at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$8$1.invoke(KotlinSymbolProcessingExtension.kt:310)
	at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$8$1.invoke(KotlinSymbolProcessingExtension.kt:308)
	at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:414)
	at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:308)
	at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:112)
	at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:75)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze$lambda$12(KotlinToJVMBytecodeCompiler.kt:373)
	at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:112)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:364)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.runFrontendAndGenerateIrUsingClassicFrontend(KotlinToJVMBytecodeCompiler.kt:195)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:106)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:170)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:43)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:103)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:49)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1555)
	at jdk.internal.reflect.GeneratedMethodAccessor92.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:840)

e: Error occurred in KSP, check log for detail
Checking the source for this seems to indicate type type can't be found in either of these maps which feels like I've omitted something, but all my destination annotations and graph declarations match the documentation.
Copy code
if (type.isCustomTypeNavArg()) customNavTypeByType[type.value]!!.importable.qualifiedName else coreTypes[type.value]!!.qualifiedName
The arguments I have are all strings, primitives, enums, @Serializable, Arrays or navigators. So I'm not sure why this can't be found. Is there a way to debug which parameter is causing this failure?
r
Hi @James Riordan 👋 Hmm this is indeed weird.. unfortunately I’m not on my PC atm. Will check this once I’m back home.
Plus I definitely can improve the error messages here. I think I’ve done so in most other places.. which is why this is weird. The fact i haven’t done so here, would suggest you’re the first to encounter this 😅
j
Looks like this is being caused by this
Copy code
@Destination<SplashGraph>(style = NonDismissableDialog::class)
@Composable
fun InitialLoadingGoToWebsiteDialog(
    navigator: ResultBackNavigator<Unit>,
    debugMessage: String,
)
The
ModuleRegistryWriter
iterates through the Unit type which doesn't exist in either list of types and it crashes.
r
Wow thanks so much for digging deep on this 🙏I was planning to take some time for CD today. Hmm.. why do you need a result back navigator if you’re never sending any result? 🤔 In any case, I definitely should improve the error message here, I’m glad you spotted it.
j
Yeah I've changed the back navigator to a
DestinationsNavigator
and that seems fine. Something's changed though as we've had that in for over a year
r
Yeah, it may have been with the improvements that now the result type is treated in a similar manner as any navigation argument is. So maybe Unit was possible before, even if it doesn't really make sense - but at the same time, why not also allow it. I'll take a look to see how to best improve this one. Thank you once again 🙇 🙏
1