KT-57207 Implement JavaClassFinder.findClasses

- This change is a prerequisite for allowing combined Java symbol
  providers (in LL FIR) to correctly disambiguate classpath order after
  getting classes with a combined scope, as the index access of the
  combined Java symbol provider is not guaranteed to return the class
  that should be first based on the original dependency order. To be
  able to disambiguate, a combined Java symbol provider needs access to
  all class candidates the index can find.
This commit is contained in:
Marco Pennekamp
2023-03-22 14:26:11 +01:00
committed by Space Team
parent f2e3c593a1
commit 567abd2a1c
5 changed files with 64 additions and 0 deletions
@@ -21,6 +21,18 @@ interface JavaClassFinder {
fun findClass(request: Request): JavaClass?
fun findClass(classId: ClassId): JavaClass? = findClass(Request(classId))
/**
* Finds all classes with the specified [ClassId]. This function should be used if the search space permits such ambiguities and if
* [findClass] is not guaranteed to disambiguate by itself. For example, in an IDE context, a broad search scope might lead to multiple
* valid candidates, which need to be disambiguated according to classpath order.
*
* [findClasses] may return a single [JavaClass], even if more could be found, if the resulting [JavaClass] is guaranteed to be the
* first in the dependency order.
*/
fun findClasses(request: Request): List<JavaClass>
fun findClasses(classId: ClassId): List<JavaClass> = findClasses(Request(classId))
fun findPackage(fqName: FqName, mayHaveAnnotations: Boolean = true): JavaPackage?
fun knownClassNamesInPackage(packageFqName: FqName): Set<String>?