From 14fe8af614f8ab23e8e607f07ea77a7deaa6269d Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 26 Jan 2016 11:17:19 +0100 Subject: [PATCH] Kotlin compatibility (promise *Run and JvmField because now companion object require explicit annotation to be field) --- platform/built-in-server/testSrc/BinaryRequestHandlerTest.kt | 1 + platform/built-in-server/testSrc/BuiltInServerTestCase.kt | 1 + .../configuration-store-impl/testSrc/ApplicationStoreTest.kt | 1 + .../testSrc/DefaultProjectStoreTest.kt | 1 + .../testSrc/DirectoryBasedStorageTest.kt | 1 + .../configuration-store-impl/testSrc/ModuleStoreRenameTest.kt | 1 + platform/configuration-store-impl/testSrc/ModuleStoreTest.kt | 3 ++- platform/configuration-store-impl/testSrc/ProjectStoreTest.kt | 1 + .../configuration-store-impl/testSrc/SchemeManagerTest.kt | 1 + .../configuration-store-impl/testSrc/StorageManagerTest.kt | 1 + .../platform-impl/src/org/jetbrains/concurrency/promise.kt | 4 ++-- plugins/settings-repository/testSrc/GitTestCase.kt | 1 + plugins/settings-repository/testSrc/LoadTest.kt | 1 + 13 files changed, 15 insertions(+), 3 deletions(-) diff --git a/platform/built-in-server/testSrc/BinaryRequestHandlerTest.kt b/platform/built-in-server/testSrc/BinaryRequestHandlerTest.kt index 36b8f96c2f11..c077f10afa80 100644 --- a/platform/built-in-server/testSrc/BinaryRequestHandlerTest.kt +++ b/platform/built-in-server/testSrc/BinaryRequestHandlerTest.kt @@ -20,6 +20,7 @@ import java.util.concurrent.TimeUnit // we don't handle String in efficient way - because we want to test readContent/readChars also internal class BinaryRequestHandlerTest { companion object { + @JvmField @ClassRule val projectRule = ProjectRule() } diff --git a/platform/built-in-server/testSrc/BuiltInServerTestCase.kt b/platform/built-in-server/testSrc/BuiltInServerTestCase.kt index 58e83935b6fc..bacf2a03e4f7 100644 --- a/platform/built-in-server/testSrc/BuiltInServerTestCase.kt +++ b/platform/built-in-server/testSrc/BuiltInServerTestCase.kt @@ -15,6 +15,7 @@ import java.util.concurrent.TimeUnit internal abstract class BuiltInServerTestCase { companion object { + @JvmField @ClassRule val projectRule = ProjectRule() } diff --git a/platform/configuration-store-impl/testSrc/ApplicationStoreTest.kt b/platform/configuration-store-impl/testSrc/ApplicationStoreTest.kt index e3601ee792fb..2c2067da06a3 100644 --- a/platform/configuration-store-impl/testSrc/ApplicationStoreTest.kt +++ b/platform/configuration-store-impl/testSrc/ApplicationStoreTest.kt @@ -46,6 +46,7 @@ import kotlin.properties.Delegates internal class ApplicationStoreTest { companion object { + @JvmField @ClassRule val projectRule = ProjectRule() } diff --git a/platform/configuration-store-impl/testSrc/DefaultProjectStoreTest.kt b/platform/configuration-store-impl/testSrc/DefaultProjectStoreTest.kt index a073215dc5a7..63334ea21802 100644 --- a/platform/configuration-store-impl/testSrc/DefaultProjectStoreTest.kt +++ b/platform/configuration-store-impl/testSrc/DefaultProjectStoreTest.kt @@ -19,6 +19,7 @@ import java.nio.file.Paths internal class DefaultProjectStoreTest { companion object { + @JvmField @ClassRule val projectRule = ProjectRule() private const val TEST_COMPONENT_NAME = "Foo" diff --git a/platform/configuration-store-impl/testSrc/DirectoryBasedStorageTest.kt b/platform/configuration-store-impl/testSrc/DirectoryBasedStorageTest.kt index d942be7d68c9..2f7a2a7d7121 100644 --- a/platform/configuration-store-impl/testSrc/DirectoryBasedStorageTest.kt +++ b/platform/configuration-store-impl/testSrc/DirectoryBasedStorageTest.kt @@ -55,6 +55,7 @@ internal class TestStateSplitter : MainConfigurationStateSplitter() { @Bombed(user = "vladimir.krivosheev", year = 2016, month = Calendar.DECEMBER, day = 10) internal class DirectoryBasedStorageTest { companion object { + @JvmField @ClassRule val projectRule = ProjectRule() } diff --git a/platform/configuration-store-impl/testSrc/ModuleStoreRenameTest.kt b/platform/configuration-store-impl/testSrc/ModuleStoreRenameTest.kt index a4ff7678dfa2..4d5253ab917d 100644 --- a/platform/configuration-store-impl/testSrc/ModuleStoreRenameTest.kt +++ b/platform/configuration-store-impl/testSrc/ModuleStoreRenameTest.kt @@ -28,6 +28,7 @@ import kotlin.properties.Delegates internal class ModuleStoreRenameTest { companion object { + @JvmField @ClassRule val projectRule = ProjectRule() private val Module.storage: FileBasedStorage diff --git a/platform/configuration-store-impl/testSrc/ModuleStoreTest.kt b/platform/configuration-store-impl/testSrc/ModuleStoreTest.kt index d48f33c9210f..7724e4c08e5d 100644 --- a/platform/configuration-store-impl/testSrc/ModuleStoreTest.kt +++ b/platform/configuration-store-impl/testSrc/ModuleStoreTest.kt @@ -26,7 +26,8 @@ import java.nio.file.Paths @RunsInActiveStoreMode class ModuleStoreTest { companion object { - @ClassRule val projectRule = ProjectRule() + @JvmField + @ClassRule val projectRule = ProjectRule() val MODULE_DIR = "\$MODULE_DIR$" diff --git a/platform/configuration-store-impl/testSrc/ProjectStoreTest.kt b/platform/configuration-store-impl/testSrc/ProjectStoreTest.kt index 3e985a97591b..c2350d80947b 100644 --- a/platform/configuration-store-impl/testSrc/ProjectStoreTest.kt +++ b/platform/configuration-store-impl/testSrc/ProjectStoreTest.kt @@ -71,6 +71,7 @@ private fun createOrLoadProject(tempDirManager: TemporaryDirectory, task: (Proje internal class ProjectStoreTest { companion object { + @JvmField @ClassRule val projectRule = ProjectRule() } diff --git a/platform/configuration-store-impl/testSrc/SchemeManagerTest.kt b/platform/configuration-store-impl/testSrc/SchemeManagerTest.kt index 5254eafe518b..7532fa4bf183 100644 --- a/platform/configuration-store-impl/testSrc/SchemeManagerTest.kt +++ b/platform/configuration-store-impl/testSrc/SchemeManagerTest.kt @@ -48,6 +48,7 @@ internal val FILE_SPEC = "REMOTE" */ internal class SchemeManagerTest { companion object { + @JvmField @ClassRule val projectRule = ProjectRule() } diff --git a/platform/configuration-store-impl/testSrc/StorageManagerTest.kt b/platform/configuration-store-impl/testSrc/StorageManagerTest.kt index de91c8966b8c..29cbf7319ef6 100644 --- a/platform/configuration-store-impl/testSrc/StorageManagerTest.kt +++ b/platform/configuration-store-impl/testSrc/StorageManagerTest.kt @@ -31,6 +31,7 @@ internal class StorageManagerTest { companion object { val MACRO = "\$MACRO1$" + @JvmField @ClassRule val projectRule = ProjectRule() } diff --git a/platform/platform-impl/src/org/jetbrains/concurrency/promise.kt b/platform/platform-impl/src/org/jetbrains/concurrency/promise.kt index d3e1ba53bf1a..6e6134e3eaff 100644 --- a/platform/platform-impl/src/org/jetbrains/concurrency/promise.kt +++ b/platform/platform-impl/src/org/jetbrains/concurrency/promise.kt @@ -54,10 +54,10 @@ inline fun Promise<*>.processed(node: Obsolescent, crossinline handler: () -> Un inline fun Promise<*>.doneRun(crossinline handler: () -> Unit) = (this as Promise).done { handler() } @Suppress("UNCHECKED_CAST") -inline fun Promise<*>.then(crossinline handler: () -> T): Promise = (this as Promise).then { handler() } +inline fun Promise<*>.thenRun(crossinline handler: () -> T): Promise = (this as Promise).then { handler() } @Suppress("UNCHECKED_CAST") -inline fun Promise<*>.processed(crossinline handler: () -> Unit): Promise<*> = (this as Promise).processed { handler() } +inline fun Promise<*>.processedRun(crossinline handler: () -> Unit): Promise<*> = (this as Promise).processed { handler() } inline fun Promise.thenAsync(node: Obsolescent, crossinline handler: (T) -> Promise) = thenAsync(object : ValueNodeAsyncFunction(node) { diff --git a/plugins/settings-repository/testSrc/GitTestCase.kt b/plugins/settings-repository/testSrc/GitTestCase.kt index 0530ec0dbdf1..c40b57a54576 100644 --- a/plugins/settings-repository/testSrc/GitTestCase.kt +++ b/plugins/settings-repository/testSrc/GitTestCase.kt @@ -17,6 +17,7 @@ import kotlin.properties.Delegates internal abstract class GitTestCase : IcsTestCase() { companion object { + @JvmField @ClassRule val projectRule = ProjectRule() } diff --git a/plugins/settings-repository/testSrc/LoadTest.kt b/plugins/settings-repository/testSrc/LoadTest.kt index 0ace1b27f68f..85ebccd8c230 100644 --- a/plugins/settings-repository/testSrc/LoadTest.kt +++ b/plugins/settings-repository/testSrc/LoadTest.kt @@ -32,6 +32,7 @@ import java.io.File class LoadTest : IcsTestCase() { companion object { + @JvmField @ClassRule val projectRule = ProjectRule() }