diff --git a/platform/ide-core-impl/src/com/intellij/openapi/vfs/local/PluggableFileWatcher.java b/platform/ide-core-impl/src/com/intellij/openapi/vfs/local/PluggableFileWatcher.java index e91675615a12..cbc153810093 100644 --- a/platform/ide-core-impl/src/com/intellij/openapi/vfs/local/PluggableFileWatcher.java +++ b/platform/ide-core-impl/src/com/intellij/openapi/vfs/local/PluggableFileWatcher.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.vfs.local; import com.intellij.openapi.extensions.ExtensionPointName; @@ -9,9 +9,6 @@ import org.jetbrains.annotations.TestOnly; import java.io.IOException; import java.util.List; -/** - * @author dslomov - */ public abstract class PluggableFileWatcher { public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.vfs.local.pluggableFileWatcher"); @@ -26,6 +23,8 @@ public abstract class PluggableFileWatcher { /** * The inputs to this method must be absolute and free of symbolic links. + * + * @implNote An implementation must report paths it doesn't recognize via {@link FileWatcherNotificationSink#notifyManualWatchRoots}. */ public abstract void setWatchRoots(@NotNull List recursive, @NotNull List flat); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/WslFileWatcherTest.kt b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/WslFileWatcherTest.kt index 83738beb9836..798a9595c4ef 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/WslFileWatcherTest.kt +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/local/WslFileWatcherTest.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.vfs.local import com.intellij.execution.configurations.GeneralCommandLine @@ -123,12 +123,11 @@ class WslFileWatcherTest : BareTestFixtureTestCase() { @Test fun testFileRoot() { val files = arrayOf(tempDir.newFile("test1.txt"), tempDir.newFile("test2.txt")) - files.forEach { refresh(it) } - files.forEach { watch(it, false) } + files.forEach { refresh(it); watch(it, false) } - assertEvents({ files.forEach { it.writeText("new content") } }, files.map { it to 'U' }.toMap()) - assertEvents({ files.forEach { assertTrue(it.delete()) } }, files.map { it to 'D' }.toMap()) - assertEvents({ files.forEach { it.writeText("re-creation") } }, files.map { it to 'C' }.toMap()) + assertEvents({ files.forEach { it.writeText("new content") } }, files.associateWith { 'U' }) + assertEvents({ files.forEach { assertTrue(it.delete()) } }, files.associateWith { 'D' }) + assertEvents({ files.forEach { it.writeText("re-creation") } }, files.associateWith { 'C' }) } @Test fun testFileRootRecursive() { @@ -136,9 +135,9 @@ class WslFileWatcherTest : BareTestFixtureTestCase() { files.forEach { refresh(it) } files.forEach { watch(it, true) } - assertEvents({ files.forEach { it.writeText("new content") } }, files.map { it to 'U' }.toMap()) - assertEvents({ files.forEach { assertTrue(it.delete()) } }, files.map { it to 'D' }.toMap()) - assertEvents({ files.forEach { it.writeText("re-creation") } }, files.map { it to 'C' }.toMap()) + assertEvents({ files.forEach { it.writeText("new content") } }, files.associateWith { 'U' }) + assertEvents({ files.forEach { assertTrue(it.delete()) } }, files.associateWith { 'D' }) + assertEvents({ files.forEach { it.writeText("re-creation") } }, files.associateWith { 'C' }) } @Test fun testDirectoryRecursive() {