Remove obsolete bunch fixes for 173 & as31

This commit is contained in:
Vyacheslav Gerasimov
2019-01-14 16:26:55 +03:00
parent b1f25874d8
commit 2157c777b3
11 changed files with 10 additions and 114 deletions
@@ -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)
}
@@ -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);
}
}
@@ -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)
}
@@ -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<String>) {
processAllClassNames(com.intellij.util.CommonProcessors.CollectProcessor(dest))
}
override fun getAllMethodNames(set: com.intellij.util.containers.HashSet<String>) {
java.util.Collections.addAll(set, *allMethodNames)
}
override fun getAllFieldNames(set: com.intellij.util.containers.HashSet<String>) {
java.util.Collections.addAll(set, *allFieldNames)
}
}
*/
@@ -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);
}
}
@@ -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();
@@ -87,8 +87,6 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
}
})
}
fixTemplates()
}
override fun tearDown() {
@@ -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() {
}
@@ -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)
@@ -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);
@@ -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
}