Cleanup (clarifying PluggableFileWatcher documentation; warnings; formatting)

GitOrigin-RevId: 3cc40d7c963f1e13b4e3f9295a043825043742d3
This commit is contained in:
Roman Shevchenko
2022-09-05 11:35:06 +02:00
committed by intellij-monorepo-bot
parent 686a631854
commit 1114b1d2fb
2 changed files with 11 additions and 13 deletions

View File

@@ -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<PluggableFileWatcher> 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 <b>must report</b> paths it doesn't recognize via {@link FileWatcherNotificationSink#notifyManualWatchRoots}.
*/
public abstract void setWatchRoots(@NotNull List<String> recursive, @NotNull List<String> flat);

View File

@@ -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() {