Abstract data is forbidden: Idea module infos fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
67755d7dca
commit
5f43628f1b
@@ -116,24 +116,35 @@ internal fun ModuleSourceInfo.isTests() = this is ModuleTestSourceInfo
|
|||||||
public fun Module.productionSourceInfo(): ModuleProductionSourceInfo = ModuleProductionSourceInfo(this)
|
public fun Module.productionSourceInfo(): ModuleProductionSourceInfo = ModuleProductionSourceInfo(this)
|
||||||
public fun Module.testSourceInfo(): ModuleTestSourceInfo = ModuleTestSourceInfo(this)
|
public fun Module.testSourceInfo(): ModuleTestSourceInfo = ModuleTestSourceInfo(this)
|
||||||
|
|
||||||
private abstract data class ModuleSourceScope(val module: Module) : GlobalSearchScope(module.getProject()) {
|
private abstract class ModuleSourceScope(val module: Module) : GlobalSearchScope(module.getProject()) {
|
||||||
override fun compare(file1: VirtualFile, file2: VirtualFile) = 0
|
override fun compare(file1: VirtualFile, file2: VirtualFile) = 0
|
||||||
override fun isSearchInModuleContent(aModule: Module) = aModule == module
|
override fun isSearchInModuleContent(aModule: Module) = aModule == module
|
||||||
override fun isSearchInLibraries() = false
|
override fun isSearchInLibraries() = false
|
||||||
|
|
||||||
// KT-6206
|
|
||||||
override fun hashCode(): Int = module.hashCode()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ModuleProductionSourceScope(module: Module) : ModuleSourceScope(module) {
|
private class ModuleProductionSourceScope(module: Module) : ModuleSourceScope(module) {
|
||||||
val moduleFileIndex = ModuleRootManager.getInstance(module).getFileIndex()
|
val moduleFileIndex = ModuleRootManager.getInstance(module).getFileIndex()
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
return (other is ModuleProductionSourceScope && module == other.module)
|
||||||
|
}
|
||||||
|
// KT-6206
|
||||||
|
override fun hashCode(): Int = 31 * module.hashCode()
|
||||||
|
|
||||||
override fun contains(file: VirtualFile) = moduleFileIndex.isInSourceContent(file) && !moduleFileIndex.isInTestSourceContent(file)
|
override fun contains(file: VirtualFile) = moduleFileIndex.isInSourceContent(file) && !moduleFileIndex.isInTestSourceContent(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ModuleTestSourceScope(module: Module) : ModuleSourceScope(module) {
|
private class ModuleTestSourceScope(module: Module) : ModuleSourceScope(module) {
|
||||||
val moduleFileIndex = ModuleRootManager.getInstance(module).getFileIndex()
|
val moduleFileIndex = ModuleRootManager.getInstance(module).getFileIndex()
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
return (other is ModuleTestSourceScope && module == other.module)
|
||||||
|
}
|
||||||
|
// KT-6206
|
||||||
|
override fun hashCode(): Int = 37 * module.hashCode()
|
||||||
|
|
||||||
override fun contains(file: VirtualFile) = moduleFileIndex.isInTestSourceContent(file)
|
override fun contains(file: VirtualFile) = moduleFileIndex.isInTestSourceContent(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user