cleanup [java]: introduce data class instead of Pair in ClassAncestorResolver to make code more readable (IJ-CR-188646)

Space-RevId: 677557d66e2954f5d2996fc4adab14e87f919679

GitOrigin-RevId: c9b74011da8647de7054f18f5f77b8db347caada
This commit is contained in:
Nikolay Chashnikov
2026-01-22 11:30:43 +01:00
committed by intellij-monorepo-bot
parent a08972374a
commit 175f4430dc

View File

@@ -43,14 +43,19 @@ internal class ClassAncestorResolver(private val classpath: List<Path>) {
}
private fun collectPackagesInClasspath(classpath: List<Path>): Map<String, List<Path>> {
data class PackageToClasspathRoot(val packageName: String, val classpathRoot: Path)
return classpath
.asSequence()
.flatMap { root ->
withClassRootEntries(root) {
it.map { entry -> root to entry.entryName.substringBeforeLast(delimiter = '/', missingDelimiterValue = "") }.toSet()
.flatMap { classpathRoot ->
withClassRootEntries(classpathRoot) {
it.map { entry ->
val packageName = entry.entryName.substringBeforeLast(delimiter = '/', missingDelimiterValue = "")
PackageToClasspathRoot(packageName, classpathRoot)
}.toSet()
}
}
.groupBy({ it.second }, { it.first })
.groupBy({ it.packageName }, { it.classpathRoot })
}
private fun collectSuperclasses(binaryClassName: String): List<String> {