From 2157c777b310e92d42fe7c139919e8f85a7ddef1 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Mon, 14 Jan 2019 16:26:55 +0300 Subject: [PATCH] Remove obsolete bunch fixes for 173 & as31 --- .../idea/core/formatter/compatibility.kt | 17 ----------- .../KotlinCommonCodeStyleSettings.java | 3 +- .../idea/caches/KotlinShortNamesCache.kt | 3 +- .../caches/PsiShortNamesCacheCompatibility.kt | 29 ------------------- .../test/CompletionTestCaseWrapper.java | 29 ------------------- .../test/KotlinCompletionTestCase.java | 2 +- .../KotlinLightCodeInsightFixtureTestCase.kt | 2 -- .../kotlin/idea/test/fixTemplates.kt | 13 --------- .../configuration/ui/migrationNotification.kt | 14 ++++----- .../AbstractOutOfBlockModificationTest.java | 10 ------- .../script/AbstractScriptConfigurationTest.kt | 2 +- 11 files changed, 10 insertions(+), 114 deletions(-) delete mode 100644 idea/formatter/src/org/jetbrains/kotlin/idea/core/formatter/compatibility.kt delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/PsiShortNamesCacheCompatibility.kt delete mode 100644 idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/CompletionTestCaseWrapper.java delete mode 100644 idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/fixTemplates.kt diff --git a/idea/formatter/src/org/jetbrains/kotlin/idea/core/formatter/compatibility.kt b/idea/formatter/src/org/jetbrains/kotlin/idea/core/formatter/compatibility.kt deleted file mode 100644 index 4aa2ce8845f..00000000000 --- a/idea/formatter/src/org/jetbrains/kotlin/idea/core/formatter/compatibility.kt +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.core.formatter - -import com.intellij.psi.codeStyle.CommonCodeStyleSettings - -/** - * Method copyFrom is absent in 173. - * BUNCH: 181 - */ -fun CommonCodeStyleSettings.copyFromEx(source: CommonCodeStyleSettings) { - @Suppress("IncompatibleAPI") - copyFrom(source) -} \ No newline at end of file diff --git a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonCodeStyleSettings.java b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonCodeStyleSettings.java index bb0e694e7c4..4735b73400c 100644 --- a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonCodeStyleSettings.java +++ b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonCodeStyleSettings.java @@ -21,7 +21,6 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.idea.KotlinLanguage; -import org.jetbrains.kotlin.idea.core.formatter.CompatibilityKt; import org.jetbrains.kotlin.idea.util.FormatterUtilKt; import org.jetbrains.kotlin.idea.util.ReflectionUtil; @@ -237,7 +236,7 @@ public class KotlinCommonCodeStyleSettings extends CommonCodeStyleSettings { public void restore() { if (settingsAgainstPreviousDefaults != null) { - CompatibilityKt.copyFromEx(this, settingsAgainstPreviousDefaults); + copyFrom(settingsAgainstPreviousDefaults); } } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/KotlinShortNamesCache.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/KotlinShortNamesCache.kt index 3551b1d863d..862d4c052e1 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/KotlinShortNamesCache.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/KotlinShortNamesCache.kt @@ -24,6 +24,7 @@ import com.intellij.psi.PsiClass import com.intellij.psi.PsiField import com.intellij.psi.PsiMethod import com.intellij.psi.search.GlobalSearchScope +import com.intellij.psi.search.PsiShortNamesCache import com.intellij.psi.stubs.StubIndex import com.intellij.util.ArrayUtil import com.intellij.util.Processor @@ -46,7 +47,7 @@ import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtNamedDeclaration import org.jetbrains.kotlin.psi.KtNamedFunction -class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCacheWrapper() { +class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache() { companion object { private val LOG = Logger.getInstance(KotlinShortNamesCache::class.java) } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/PsiShortNamesCacheCompatibility.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/PsiShortNamesCacheCompatibility.kt deleted file mode 100644 index 0cd4bfb85f4..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/PsiShortNamesCacheCompatibility.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.caches - -import com.intellij.psi.search.PsiShortNamesCache - -typealias PsiShortNamesCacheWrapper = PsiShortNamesCache - -/* -// Need to implement deprecated methods. Should be removed after abandoning 173 and AS 3.1 branch. -// BUNCH: 181 -@Suppress("OverridingDeprecatedMember", "DEPRECATION") -abstract class PsiShortNamesCacheCompatibility : PsiShortNamesCache() { - override fun getAllClassNames(dest: com.intellij.util.containers.HashSet) { - processAllClassNames(com.intellij.util.CommonProcessors.CollectProcessor(dest)) - } - - override fun getAllMethodNames(set: com.intellij.util.containers.HashSet) { - java.util.Collections.addAll(set, *allMethodNames) - } - - override fun getAllFieldNames(set: com.intellij.util.containers.HashSet) { - java.util.Collections.addAll(set, *allFieldNames) - } -} -*/ \ No newline at end of file diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/CompletionTestCaseWrapper.java b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/CompletionTestCaseWrapper.java deleted file mode 100644 index 77fd896fb60..00000000000 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/CompletionTestCaseWrapper.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.completion.test; - -import com.intellij.codeInsight.completion.CompletionTestCase; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleType; -import com.intellij.openapi.project.Project; -import com.intellij.testFramework.PlatformTestCase; -import org.jetbrains.annotations.NotNull; - -/** - * Wrapper for CompletionTestCase that deals with compatibility issues. - * Should be dropped after abandoning 173. - * BUNCH: 181 - */ -@SuppressWarnings({"MethodMayBeStatic", "IncompatibleAPI"}) -abstract public class CompletionTestCaseWrapper extends CompletionTestCase { - protected Module createModuleAtWrapper(String moduleName, Project project, ModuleType moduleType, String path) { - return createModuleAt(moduleName, project, moduleType, path); - } - - protected Module doCreateRealModuleInWrapper(@NotNull String moduleName, @NotNull Project project, ModuleType moduleType) { - return doCreateRealModuleIn(moduleName, project, moduleType); - } -} diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/KotlinCompletionTestCase.java b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/KotlinCompletionTestCase.java index d80664c3a77..9b0824a2a3a 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/KotlinCompletionTestCase.java +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/KotlinCompletionTestCase.java @@ -22,7 +22,7 @@ import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; import com.intellij.util.ArrayUtil; import org.jetbrains.kotlin.test.KotlinTestUtils; -abstract public class KotlinCompletionTestCase extends CompletionTestCaseWrapper { +abstract public class KotlinCompletionTestCase extends CompletionTestCase { @Override protected void setUp() throws Exception { super.setUp(); diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt index 79b650b944f..b3994bd049c 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt @@ -87,8 +87,6 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix } }) } - - fixTemplates() } override fun tearDown() { diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/fixTemplates.kt b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/fixTemplates.kt deleted file mode 100644 index b80fc349702..00000000000 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/fixTemplates.kt +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -@file:Suppress("UnusedImport") - -package org.jetbrains.kotlin.idea.test - -// Unneeded in 181, but used in 173 -// BUNCH: 181 -internal fun fixTemplates() { -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/configuration/ui/migrationNotification.kt b/idea/src/org/jetbrains/kotlin/idea/configuration/ui/migrationNotification.kt index b975b9625a0..ff7402a77b6 100644 --- a/idea/src/org/jetbrains/kotlin/idea/configuration/ui/migrationNotification.kt +++ b/idea/src/org/jetbrains/kotlin/idea/configuration/ui/migrationNotification.kt @@ -38,16 +38,12 @@ internal fun showMigrationNotification(project: Project, migrationInfo: Migratio null ) .also { notification -> - notification.addAction(object : NotificationAction("Run migrations") { - // Replace with NotificationAction.createSimple after abandoning 173 and as31 - // BUNCH: 181 - override fun actionPerformed(e: AnActionEvent, notification: Notification) { - val projectContext = SimpleDataContext.getProjectContext(project) - val action = ActionManager.getInstance().getAction(CodeMigrationAction.ACTION_ID) - Notification.fire(notification, action, projectContext) + notification.addAction(NotificationAction.createSimple("Run migrations") { + val projectContext = SimpleDataContext.getProjectContext(project) + val action = ActionManager.getInstance().getAction(CodeMigrationAction.ACTION_ID) + Notification.fire(notification, action, projectContext) - notification.expire() - } + notification.expire() }) } .notify(project) diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractOutOfBlockModificationTest.java b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractOutOfBlockModificationTest.java index 274db96216e..abe17798345 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractOutOfBlockModificationTest.java +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractOutOfBlockModificationTest.java @@ -55,16 +55,6 @@ public abstract class AbstractOutOfBlockModificationTest extends KotlinLightCode boolean expectedOutOfBlock = getExpectedOutOfBlockResult(); boolean isSkipCheckDefined = InTextDirectivesUtils.isDirectiveDefined(myFixture.getFile().getText(), "SKIP_ANALYZE_CHECK"); - // Special behaviour in 173, should be dropped after abandoning this version. - // BUNCH: 181 - if ("InGlobalPropertyWithGetter".equals(getTestName(false))) { - String apiVersion = ApplicationInfo.getInstance().getApiVersion(); - if (apiVersion != null && apiVersion.contains("-173.")) { - expectedOutOfBlock = true; - isSkipCheckDefined = true; - } - } - assertTrue("It's allowed to skip check with analyze only for tests where out-of-block is expected", !isSkipCheckDefined || expectedOutOfBlock); diff --git a/idea/tests/org/jetbrains/kotlin/idea/script/AbstractScriptConfigurationTest.kt b/idea/tests/org/jetbrains/kotlin/idea/script/AbstractScriptConfigurationTest.kt index 9c6440a2250..db63d687b18 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/script/AbstractScriptConfigurationTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/script/AbstractScriptConfigurationTest.kt @@ -232,7 +232,7 @@ abstract class AbstractScriptConfigurationTest : KotlinCompletionTestCase() { private fun createTestModuleByName(name: String): Module { val newModuleDir = runWriteAction { VfsUtil.createDirectoryIfMissing(project.baseDir, name) } - val newModule = createModuleAtWrapper(name, project, JavaModuleType.getModuleType(), newModuleDir.path) + val newModule = createModuleAt(name, project, JavaModuleType.getModuleType(), newModuleDir.path) PsiTestUtil.addSourceContentToRoots(newModule, newModuleDir) return newModule }