diff --git a/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/java/KSAnnotationJavaImpl.kt b/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/java/KSAnnotationJavaImpl.kt index 1730461fe5..6e3f3ee85d 100644 --- a/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/java/KSAnnotationJavaImpl.kt +++ b/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/java/KSAnnotationJavaImpl.kt @@ -67,7 +67,7 @@ class KSAnnotationJavaImpl private constructor(private val psi: PsiAnnotation, o override val arguments: List by lazy { val annotationConstructor = analyze { - (type.classifierSymbol() as KtClassOrObjectSymbol).getMemberScope().getConstructors().singleOrNull() + (type.classifierSymbol() as? KtClassOrObjectSymbol)?.getMemberScope()?.getConstructors()?.singleOrNull() } val presentArgs = psi.parameterList.attributes.mapIndexed { index, it -> val name = it.name ?: annotationConstructor?.valueParameters?.getOrNull(index)?.name?.asString() @@ -91,7 +91,7 @@ class KSAnnotationJavaImpl private constructor(private val psi: PsiAnnotation, o override val defaultArguments: List by lazy { analyze { - (type.classifierSymbol() as KtClassOrObjectSymbol).getMemberScope().getConstructors().singleOrNull() + (type.classifierSymbol() as? KtClassOrObjectSymbol)?.getMemberScope()?.getConstructors()?.singleOrNull() ?.let { symbol -> if (symbol.origin == KtSymbolOrigin.JAVA && symbol.psi != null) { (symbol.psi as PsiClass).allMethods.filterIsInstance()