[FIR][Serialization] Use resolvedCompilerAnnotationsWithClassIds to avoid recursive resolve

`resolvedAnnotationsWithClassIds` requires resolve to TYPES phase,
which is unavailable during compiler plugins stages. Trying to resolve
to that phases will cause an infinite recursive resolve loop

Also, call `resolvedAnnotationsWithArguments` only when
`neededArguments` is true

^KTIJ-24893 Fixed
This commit is contained in:
Roman Golyshev
2023-03-13 15:51:22 +01:00
committed by teamcity
parent 5505fd207e
commit ff7c095fb3
@@ -84,7 +84,11 @@ val FirClassSymbol<*>.hasSerializableAnnotation: Boolean
get() = serializableAnnotation(needArguments = false, this@FirSession) != null
fun FirBasedSymbol<*>.serializableAnnotation(needArguments: Boolean, session: FirSession): FirAnnotation? {
val annotations = if (needArguments) resolvedAnnotationsWithClassIds else resolvedAnnotationsWithArguments
val annotations = if (needArguments) {
resolvedAnnotationsWithArguments
} else {
resolvedCompilerAnnotationsWithClassIds
}
return annotations.serializableAnnotation(session)
}