Don't consider a directory to be a package if there's a .java or .class file with the same name in its parent directory
#KT-12664 Fixed
This commit is contained in:
@@ -220,7 +220,7 @@ class JvmDependenciesIndexImpl(_roots: List<JavaRoot>): JvmDependenciesIndex {
|
||||
}
|
||||
}
|
||||
else {
|
||||
currentFile = currentFile.findChild(subPackageName) ?: return null
|
||||
currentFile = currentFile.findChildPackage(subPackageName, pathRoot.type) ?: return null
|
||||
}
|
||||
|
||||
val correspondingCacheIndex = pathIndex + 1
|
||||
@@ -233,6 +233,21 @@ class JvmDependenciesIndexImpl(_roots: List<JavaRoot>): JvmDependenciesIndex {
|
||||
return currentFile
|
||||
}
|
||||
|
||||
private fun VirtualFile.findChildPackage(subPackageName: String, rootType: JavaRoot.RootType): VirtualFile? {
|
||||
val childDirectory = findChild(subPackageName) ?: return null
|
||||
|
||||
// Resolve conflicts between files and packages with the same qualified name in favor of files
|
||||
val fileExtension = when (rootType) {
|
||||
JavaRoot.RootType.BINARY -> ".class"
|
||||
JavaRoot.RootType.SOURCE -> ".java"
|
||||
}
|
||||
|
||||
if (findChild(subPackageName + fileExtension)?.isDirectory == false) {
|
||||
return null
|
||||
}
|
||||
return childDirectory
|
||||
}
|
||||
|
||||
private fun cachesPath(path: List<String>): List<Cache> {
|
||||
val caches = ArrayList<Cache>(path.size + 1)
|
||||
caches.add(rootCache)
|
||||
|
||||
Reference in New Issue
Block a user