Add a cache for PsiBasedClassResolver instances

The PsiBasedClassResolver constructor isn't very cheap to call
because it runs computation of conflicting names each time

Again, this is helpful for Spring-interop because PsiBasedClassResolver
is used very frequently there

 #KT-23380 Fixed
This commit is contained in:
Denis Zharkov
2018-03-22 13:07:59 +03:00
parent f060604d98
commit e162749366
3 changed files with 28 additions and 4 deletions
@@ -78,7 +78,7 @@ class KotlinAnnotatedElementsSearcher : QueryExecutor<PsiModifierListOwner, Anno
consumer: (KtDeclaration) -> Boolean): Boolean {
assert(annClass.isAnnotationType) { "Annotation type should be passed to annotated members search" }
val psiBasedClassResolver = PsiBasedClassResolver(annClass)
val psiBasedClassResolver = PsiBasedClassResolver.getInstance(annClass)
val annotationFQN = annClass.qualifiedName!!
val candidates = getKotlinAnnotationCandidates(annClass, useScope)