[kotlin] Migrate 'annotationsByClassId()' to 'annotations.get()'

^KT-67996

GitOrigin-RevId: df4ddc403c293e5811503354096afe73566865e6
This commit is contained in:
Yan Zhulanow
2024-06-23 01:23:31 +09:00
committed by intellij-monorepo-bot
parent 61fa9ddf1d
commit 82a2b9ee6a
2 changed files with 2 additions and 4 deletions

View File

@@ -6,7 +6,6 @@ import org.jetbrains.kotlin.analysis.api.KaExperimentalApi
import org.jetbrains.kotlin.analysis.api.KaSession
import org.jetbrains.kotlin.analysis.api.KtStarTypeProjection
import org.jetbrains.kotlin.analysis.api.annotations.KaAnnotationValue
import org.jetbrains.kotlin.analysis.api.annotations.annotationsByClassId
import org.jetbrains.kotlin.analysis.api.base.KaConstantValue
import org.jetbrains.kotlin.analysis.api.resolution.KtCallCandidateInfo
import org.jetbrains.kotlin.analysis.api.resolution.KaCallableMemberCall
@@ -175,7 +174,7 @@ fun isArrayOfCall(callElement: KtCallElement): Boolean {
*/
context(KaSession)
fun getJvmName(symbol: KaAnnotatedSymbol): String? {
val jvmNameAnnotation = symbol.annotationsByClassId(JvmStandardClassIds.Annotations.JvmName).firstOrNull() ?: return null
val jvmNameAnnotation = symbol.annotations[JvmStandardClassIds.Annotations.JvmName].firstOrNull() ?: return null
val annotationValue = jvmNameAnnotation.arguments.singleOrNull()?.expression as? KaAnnotationValue.ConstantValue ?: return null
val stringValue = annotationValue.value as? KaConstantValue.KaStringConstantValue ?: return null
return stringValue.value