[FIR] KT-57207 Avoid FirJavaFacade.knownClassNamesInPackage in the IDE
- `FirJavaFacade.knownClassNamesInPackage` cannot be computed in the IDE using the current strategy because there are multiple finders and there is no `CliFinder`. However, the cache was still used, which caused it to be filled with `null` values and additionally caused worse performance in `JavaSymbolProvider` due to hash map accesses via `hasTopLevelClassOf`. - Rewriting the strategy is non-trivial as additional indices are needed on the IDE side. See KTIJ-24642.
This commit is contained in:
committed by
Space Team
parent
624164e183
commit
288606868e
@@ -24,4 +24,10 @@ interface JavaClassFinder {
|
||||
fun findPackage(fqName: FqName, mayHaveAnnotations: Boolean = true): JavaPackage?
|
||||
|
||||
fun knownClassNamesInPackage(packageFqName: FqName): Set<String>?
|
||||
|
||||
/**
|
||||
* Whether [knownClassNamesInPackage] can be computed. When [canComputeKnownClassNamesInPackage] is `false`, [knownClassNamesInPackage]
|
||||
* will always return `null`.
|
||||
*/
|
||||
fun canComputeKnownClassNamesInPackage(): Boolean
|
||||
}
|
||||
|
||||
+1
@@ -42,6 +42,7 @@ class ReflectJavaClassFinder(private val classLoader: ClassLoader) : JavaClassFi
|
||||
}
|
||||
|
||||
override fun knownClassNamesInPackage(packageFqName: FqName): Set<String>? = null
|
||||
override fun canComputeKnownClassNamesInPackage(): Boolean = false
|
||||
}
|
||||
|
||||
fun ClassLoader.tryLoadClass(fqName: String) =
|
||||
|
||||
Reference in New Issue
Block a user