diff --git a/lib/java/nio/file/annotations.xml b/lib/java/nio/file/annotations.xml new file mode 100644 index 000000000000..47656ac2b589 --- /dev/null +++ b/lib/java/nio/file/annotations.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/platform/configuration-store-impl/src/DirectoryBasedStorage.kt b/platform/configuration-store-impl/src/DirectoryBasedStorage.kt index 8365705719b0..c31da745fab6 100644 --- a/platform/configuration-store-impl/src/DirectoryBasedStorage.kt +++ b/platform/configuration-store-impl/src/DirectoryBasedStorage.kt @@ -62,7 +62,7 @@ open class DirectoryBasedStorage(private val myPathMacroSubstitutor: TrackingPat } } - override fun getStateAndArchive(storageData: Map, component: Any, componentName: String) = getCompositeStateAndArchive(storageData, componentName, mySplitter) + override fun getState(storageData: Map, component: Any?, componentName: String) = getCompositeStateAndArchive(storageData, componentName, mySplitter) override fun loadData(): MutableMap { return fromMap(DirectoryStorageUtil.loadFrom(getVirtualFile(), myPathMacroSubstitutor)) diff --git a/platform/configuration-store-impl/testSrc/ModuleStoreTest.kt b/platform/configuration-store-impl/testSrc/ModuleStoreTest.kt index 38f81e2682ce..4a6e417e69e7 100644 --- a/platform/configuration-store-impl/testSrc/ModuleStoreTest.kt +++ b/platform/configuration-store-impl/testSrc/ModuleStoreTest.kt @@ -66,6 +66,7 @@ class ModuleStoreTest { assertThat(getOptionValue("foo")).isEqualTo("not bar") setOption("foo", "not bar") + // ensure that save the same data will not lead to any problems (like "Content equals, but it must be handled not on this level") saveStore() } } diff --git a/platform/configuration-store-impl/testSrc/XmlElementStorageTest.kt b/platform/configuration-store-impl/testSrc/XmlElementStorageTest.kt index 8a991baba2e3..ad55501e98c5 100644 --- a/platform/configuration-store-impl/testSrc/XmlElementStorageTest.kt +++ b/platform/configuration-store-impl/testSrc/XmlElementStorageTest.kt @@ -17,27 +17,26 @@ package com.intellij.configurationStore import com.intellij.openapi.util.JDOMBuilder.attr import com.intellij.openapi.util.JDOMBuilder.tag -import junit.framework.TestCase import org.assertj.core.api.Assertions.assertThat import org.jdom.Element import org.junit.Test class XmlElementStorageTest { - public Test fun testGetStateSucceeded() { + @Test fun testGetStateSucceeded() { val storage = MyXmlElementStorage(tag("root", tag("component", attr("name", "test"), tag("foo")))) - val state = storage.getState(this, "test", javaClass()) - TestCase.assertNotNull(state) - TestCase.assertEquals("component", state.getName()) - TestCase.assertNotNull(state.getChild("foo")) + val state = storage.getState(this, "test", javaClass(), null, false) + assertThat(state).isNotNull() + assertThat(state!!.getName()).isEqualTo("component") + assertThat(state.getChild("foo")).isNotNull() } - public Test fun testGetStateNotSucceeded() { + @Test fun `get state not succeeded`() { val storage = MyXmlElementStorage(tag("root")) - val state = storage.getState(this, "test", javaClass()) + val state = storage.getState(this, "test", javaClass(), null, false) assertThat(state).isNull() } - public Test fun `set state overrides old state`() { + @Test fun `set state overrides old state`() { val storage = MyXmlElementStorage(tag("root", tag("component", attr("name", "test"), tag("foo")))) val newState = tag("component", attr("name", "test"), tag("bar")) val externalizationSession = storage.startExternalization()!! diff --git a/platform/projectModel-api/src/com/intellij/openapi/components/StateStorage.java b/platform/projectModel-api/src/com/intellij/openapi/components/StateStorage.java index a3ca28d7f094..09b8c8d82cdf 100644 --- a/platform/projectModel-api/src/com/intellij/openapi/components/StateStorage.java +++ b/platform/projectModel-api/src/com/intellij/openapi/components/StateStorage.java @@ -30,8 +30,6 @@ public interface StateStorage { @Nullable T getState(@Nullable Object component, @NotNull String componentName, @NotNull Class stateClass, @Nullable T mergeInto, boolean reload); - T getState(@Nullable Object component, @NotNull String componentName, @NotNull Class stateClass); - boolean hasState(@NotNull String componentName, boolean reloadData); @Nullable diff --git a/platform/testFramework/testSrc/com/intellij/testFramework/TemporaryDirectory.kt b/platform/testFramework/testSrc/com/intellij/testFramework/TemporaryDirectory.kt index ceaa3f10d201..475695c1257c 100644 --- a/platform/testFramework/testSrc/com/intellij/testFramework/TemporaryDirectory.kt +++ b/platform/testFramework/testSrc/com/intellij/testFramework/TemporaryDirectory.kt @@ -28,6 +28,7 @@ import java.io.File import java.io.IOException import java.nio.file.* import java.nio.file.attribute.BasicFileAttributes +import java.nio.file.attribute.FileTime public class TemporaryDirectory : ExternalResource() { private val paths = SmartList() @@ -110,6 +111,8 @@ public fun Path.deleteRecursively(): Path = if (exists()) Files.walkFileTree(thi } }) else this +public fun Path.getLastModifiedTime(): FileTime? = Files.getLastModifiedTime(this) + public val Path.systemIndependentPath: String get() = toString().replace(File.separatorChar, '/') diff --git a/plugins/settings-repository/src/IcsManager.kt b/plugins/settings-repository/src/IcsManager.kt index db9948761494..cd16279c9f5e 100644 --- a/plugins/settings-repository/src/IcsManager.kt +++ b/plugins/settings-repository/src/IcsManager.kt @@ -129,7 +129,7 @@ class IcsManager(dir: File) { private fun registerProjectLevelProviders(project: Project) { val storageManager = project.stateStore.getStateStorageManager() - val projectId = storageManager.getStateStorage(StoragePathMacros.WORKSPACE_FILE, RoamingType.DISABLED).getState(ProjectId(), "IcsProjectId", javaClass()) + val projectId = storageManager.getStateStorage(StoragePathMacros.WORKSPACE_FILE, RoamingType.DISABLED).getState(ProjectId(), "IcsProjectId", javaClass(), null, false) if (projectId == null || projectId.uid == null) { // not mapped, if user wants, he can map explicitly, we don't suggest // we cannot suggest "map to ICS" for any project that user opens, it will be annoying