IJPL-425: let IndexUpdateRunner.FileSet contain a set of files, not a collection

GitOrigin-RevId: 80d8d81395210ac38b299c988e8e074d73760b5f
This commit is contained in:
Andrei.Kuznetsov
2024-05-28 20:03:38 +02:00
committed by intellij-monorepo-bot
parent 7af5853f3c
commit 176ab2369e
2 changed files with 11 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.vfs.VirtualFileWithId
import com.intellij.util.indexing.FileBasedIndex
import org.jetbrains.annotations.ApiStatus.Internal
import java.util.Objects
@Internal
class FileIndexingRequest private constructor(
@@ -13,6 +14,14 @@ class FileIndexingRequest private constructor(
val file: VirtualFile,
val fileId: Int = FileBasedIndex.getFileId(file),
) {
override fun equals(other: Any?): Boolean {
return other is FileIndexingRequest && isDeleteRequest == other.isDeleteRequest && fileId == other.fileId
}
override fun hashCode(): Int {
return Objects.hash(isDeleteRequest, fileId)
}
companion object {
private val LOG = Logger.getInstance(FileIndexingRequest::class.java)

View File

@@ -55,7 +55,8 @@ class IndexUpdateRunner(fileBasedIndex: FileBasedIndexImpl,
*/
class IndexingInterruptedException(cause: Throwable) : Exception(cause)
class FileSet(project: Project, val debugName: String, internal val files: Collection<FileIndexingRequest>) {
class FileSet(project: Project, val debugName: String, internal val files: Set<FileIndexingRequest>) {
constructor(project: Project, debugName: String, files: Collection<FileIndexingRequest>) : this(project, debugName, files.toSet())
val statistics: IndexingFileSetStatistics = IndexingFileSetStatistics(project, debugName)
fun isEmpty(): Boolean = files.isEmpty()