diff --git a/compose-destinations-ksp/src/main/kotlin/com/ramcosta/composedestinations/ksp/commons/Utils.kt b/compose-destinations-ksp/src/main/kotlin/com/ramcosta/composedestinations/ksp/commons/Utils.kt index f93ce1cf..c13de3a8 100644 --- a/compose-destinations-ksp/src/main/kotlin/com/ramcosta/composedestinations/ksp/commons/Utils.kt +++ b/compose-destinations-ksp/src/main/kotlin/com/ramcosta/composedestinations/ksp/commons/Utils.kt @@ -247,7 +247,13 @@ fun KSValueParameter.toParameter( ) } -fun KSType.toGenVisibility(): Visibility { +fun Any.toGenVisibility(): Visibility { + val declaration = if (this is KSType) { + declaration + } else { + // KSP 2 + this as KSClassDeclaration + } return when (val visibility = declaration.simpleName.asString()) { "PUBLIC" -> Visibility.PUBLIC "INTERNAL" -> Visibility.INTERNAL diff --git a/compose-destinations-ksp/src/main/kotlin/com/ramcosta/composedestinations/ksp/processors/KspToCodeGenDestinationsMapper.kt b/compose-destinations-ksp/src/main/kotlin/com/ramcosta/composedestinations/ksp/processors/KspToCodeGenDestinationsMapper.kt index fd2dc00c..85d2bff6 100644 --- a/compose-destinations-ksp/src/main/kotlin/com/ramcosta/composedestinations/ksp/processors/KspToCodeGenDestinationsMapper.kt +++ b/compose-destinations-ksp/src/main/kotlin/com/ramcosta/composedestinations/ksp/processors/KspToCodeGenDestinationsMapper.kt @@ -206,7 +206,7 @@ internal class KspToCodeGenDestinationsMapper( } private fun KSAnnotation.getDestinationVisibility(): Visibility? { - return findArgumentValue("visibility")?.toGenVisibility() + return findArgumentValue("visibility")?.toGenVisibility() } private fun KSAnnotation.prepareRoute( diff --git a/compose-destinations-ksp/src/main/kotlin/com/ramcosta/composedestinations/ksp/processors/KspToCodeGenNavGraphsMapper.kt b/compose-destinations-ksp/src/main/kotlin/com/ramcosta/composedestinations/ksp/processors/KspToCodeGenNavGraphsMapper.kt index ad54e51d..f83180fe 100644 --- a/compose-destinations-ksp/src/main/kotlin/com/ramcosta/composedestinations/ksp/processors/KspToCodeGenNavGraphsMapper.kt +++ b/compose-destinations-ksp/src/main/kotlin/com/ramcosta/composedestinations/ksp/processors/KspToCodeGenNavGraphsMapper.kt @@ -60,7 +60,7 @@ internal class KspToCodeGenNavGraphsMapper( val navGraphAnnotationNameArg = navGraphAnnotation .findArgumentValue(DESTINATION_ANNOTATION_ROUTE_ARGUMENT) val navGraphVisibility = navGraphAnnotation - .findArgumentValue("visibility")!! + .findArgumentValue("visibility")!! .toGenVisibility() val navGraphDefaultTransitions = navGraphAnnotation .findArgumentValue("defaultTransitions")