[AA] KT-56617 Optimize deprecation calculation for Java class symbols
- Most Java classes aren't deprecated. To avoid building `firSymbol` in such cases, this commit adds a simple heuristic which checks the class's annotations for the presence of one of the deprecation annotations recognized by the Kotlin compiler. - Note that annotations are compared via simple names, so there is a slight margin of error. However, comparing class IDs is more costly in my tests, because getting an annotation's class ID is not as cheap as getting its simple name.
This commit is contained in:
committed by
Space Team
parent
d5933f28ab
commit
f9fb718b37
@@ -178,6 +178,12 @@ private fun FirAnnotation.getDeprecationLevel(): DeprecationLevelValue? {
|
||||
return DeprecationLevelValue.values().find { it.name == targetName }
|
||||
}
|
||||
|
||||
val deprecationAnnotationSimpleNames: Set<String> = setOf(
|
||||
StandardClassIds.Annotations.Deprecated.shortClassName.asString(),
|
||||
StandardClassIds.Annotations.Java.Deprecated.shortClassName.asString(),
|
||||
StandardClassIds.Annotations.SinceKotlin.shortClassName.asString(),
|
||||
)
|
||||
|
||||
private fun List<FirAnnotation>.extractDeprecationAnnotationInfoPerUseSite(
|
||||
session: FirSession, fromJava: Boolean
|
||||
): DeprecationAnnotationInfoPerUseSiteStorage {
|
||||
|
||||
Reference in New Issue
Block a user