question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Array and ArrayList navigation arguments

See original GitHub issue

[ksp] com.ramcosta.composedestinations.codegen.commons.IllegalDestinationsSetup: Composable ‘AmountScreen’: ‘navArgsDelegate’ cannot have arguments that are not navigation types. at com.ramcosta.composedestinations.codegen.commons.DestinationWithNavArgsMapper.getNavArgs(DestinationWithNavArgsMapper.kt:24) at com.ramcosta.composedestinations.codegen.commons.DestinationWithNavArgsMapper.map(DestinationWithNavArgsMapper.kt:12) at com.ramcosta.composedestinations.codegen.CodeGenerator.generate(CodeGenerator.kt:26) at com.ramcosta.composedestinations.ksp.processors.Processor.process(Processor.kt:44) at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$4$1.invoke(KotlinSymbolProcessingExtension.kt:186) at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$4$1.invoke(KotlinSymbolProcessingExtension.kt:184) at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:278) at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:184) at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:120) at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:86) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:252) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:243) at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:113) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:243) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:90) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:56) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:169) 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:1574) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 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)

@Parcelize
data class AmountScreenArgs(
    val sendingAmount: Float,
    val exchangeRate: Float,
    val purposeList: List<TransferPurpose>
):Parcelable


@Parcelize
data class TransferPurpose(
    val id: Int,
    val purpose: String,
    var is_selected:Boolean = false
): Parcelable


@ExperimentalMaterialApi
@ExperimentalCoilApi
@ExperimentalAnimationApi
@Composable
@Destination(navArgsDelegate = AmountScreenArgs::class)
fun AmountScreen(
    navigator: DestinationsNavigator,
    navController: NavController
) {
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
raamcostacommented, Apr 25, 2022

@miduch and @knightsamir good news, next version will have this support 🎉 I just finished pushing the changes to main branch 😃

It’ll support:

Arrays and ArrayLists (not Lists, just ArrayLists) of:

  • Float (FloatArray ✅ , Array<Float> ❌)
  • Int (IntArray ✅ , Array<Int> ❌)
  • Boolean (BooleanArray ✅ , Array<Boolean> ❌)
  • Long (LongArray ✅ , Array<Long> ❌)
  • String
  • Enums
  • Parcelables
  • Serializables
  • Ktx Serializable (annotated with @kotlinx.serialization.Serializable)
  • Custom nav arg types (types for which the user has defined a @NavTypeSerializer)
2reactions
raamcostacommented, May 1, 2022

Done on 1.5.2-beta!

Read more comments on GitHub >

github_iconTop Results From Across the Web

passing ArrayList as argument in safeArgs - android
I get that I have to set the dataType for the ArrayList but I'm not able to do it nor do I have...
Read more >
Safe Compose arguments: An improved way to navigate in ...
We loop over our arguments for each destination, and only take those arguments which are of the aforementioned types.
Read more >
ArrayList - Android Developers
The capacity is the size of the array used to store the elements in the list. ... least the number of elements specified...
Read more >
How to Pass ArrayList Object as Function Argument in java?
If we want to pass an ArrayList as an argument to a function then we can easily do it using the syntax mentioned...
Read more >
ArrayList Methods In Java - Tutorial With Example Programs
Apart from these features that help us to define ArrayList, the ArrayList class in Java also provides a full-fledged function API that consists ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found