提交 53b1a8bd 编写于 作者: V Vyacheslav Gerasimov

Remove hacks introduced for 172 platform compatibility

上级 a2bf417d
......@@ -101,22 +101,11 @@
<inspection_tool class="IncompatibleAPI" enabled="true" level="ERROR" enabled_by_default="true">
<option name="problems">
<list>
<Problem reference="org.jetbrains.plugins.gradle.util.GradleConstants#KOTLIN_DSL_SCRIPT_EXTENSION" reason="Absent in 172. Please inline." />
<Problem reference="com.intellij.psi.impl.compiled.ClsClassImpl#getQualifiedName" reason="Nullable in 173, platform in 172. Use qualifiedNameEx instead." />
<Problem reference="com.intellij.internal.statistic.utils.StatisticsUtilKt#getEnumUsage" reason="Absent in 172. Use org.jetbrains.kotlin.idea.util.compat.statistic.StatisticKt.getEnumUsage instead." />
<Problem reference="com.intellij.internal.statistic.utils.StatisticsUtilKt#getBooleanUsage" reason="Absent in 172 Use org.jetbrains.kotlin.idea.util.compat.statistic.StatisticKt.getBooleanUsage instead." />
<Problem reference="com.intellij.internal.statistic.AbstractProjectsUsagesCollector" reason="Absent in 172. Use org.jetbrains.kotlin.idea.util.compat.statistic.AbstractProjectsUsagesCollector instead." />
<Problem reference="com.intellij.openapi.progress.ProgressManager#getProgressIndicator" reason="Not null starting from 181. Use getProgressIndicatorNullable instead." />
<Problem reference="com.intellij.testFramework.PlatformTestCase#createModuleAt" reason="Not static anymore in 181 after 7dacf096c47d2125e17031c71a037b63ab00ec53" />
<Problem reference="com.intellij.testFramework.PlatformTestCase#doCreateRealModuleIn" reason="Not static anymore in 181 after 7dacf096c47d2125e17031c71a037b63ab00ec53" />
<Problem reference="com.intellij.openapi.progress.ProgressManager#getProgressIndicator" reason="Nullable in 181. Temporary use progressIndicatorNullable instead." />
<Problem reference="com.intellij.testFramework.fixtures.CodeInsightTestFixture#getProjectDisposable" reason="Method was introduced in 173 and absent in 172. Use getProjectDisposableEx instead. (95eaf81e0ea497f8c69263c11fd3202d28a7a1b2)" />
<Problem reference="org.jetbrains.org.objectweb.asm.Opcodes#V9" reason="Absent in 172 branch. Use V1_9 while 172 is supported." />
<Problem reference="com.intellij.psi.codeStyle.CommonCodeStyleSettings#getSoftMargins" reason="Absent in 172." />
<Problem reference="com.intellij.util.xmlb.XmlSerializer#serializeInto(java.lang.Object, org.jdom.Element)" reason="Absent in 172." />
<Problem reference="org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler#addSpace" reason="Method was replaced with outher methods in 182. Use addSpaceEx instead." />
<Problem reference="com.intellij.psi.util.PsiUtil#canBeOverridden" reason="Absent in 172. Use org.jetbrains.kotlin.idea.core.util.compat.psi.canBeOverridden() instead." />
<Problem reference="com.intellij.psi.util.PsiTreeUtilKt#parentOfType(com.intellij.psi.PsiElement)" reason="Absent in 172. Use org.jetbrains.kotlin.psi.psiUtil.getParentOfType instead." />
</list>
</option>
</inspection_tool>
......
......@@ -29,8 +29,8 @@ enum class JvmTarget(override val description: String) : TargetPlatformVersion {
JVM_1_6 -> Opcodes.V1_6
JVM_1_8 ->
when {
java.lang.Boolean.valueOf(System.getProperty("kotlin.test.substitute.bytecode.1.8.to.10")) -> Opcodes.V1_9 + 1
java.lang.Boolean.valueOf(System.getProperty("kotlin.test.substitute.bytecode.1.8.to.1.9")) -> Opcodes.V1_9
java.lang.Boolean.valueOf(System.getProperty("kotlin.test.substitute.bytecode.1.8.to.10")) -> Opcodes.V9 + 1
java.lang.Boolean.valueOf(System.getProperty("kotlin.test.substitute.bytecode.1.8.to.1.9")) -> Opcodes.V9
else -> Opcodes.V1_8
}
}
......@@ -48,7 +48,7 @@ enum class JvmTarget(override val description: String) : TargetPlatformVersion {
val platformDescription = values().find { it.bytecodeVersion == bytecodeVersion }?.description ?:
when (bytecodeVersion) {
Opcodes.V1_7 -> "1.7"
Opcodes.V1_9 -> "1.9"
Opcodes.V9 -> "1.9"
else -> null
}
......
......@@ -96,7 +96,7 @@ public class KotlinCommonCodeStyleSettings extends CommonCodeStyleSettings {
}
//noinspection deprecation
DefaultJDOMExternalizer.writeExternal(this, element, new SupportedFieldsDiffFilter(this, supportedFields, defaultSettings));
@SuppressWarnings("IncompatibleAPI") List<Integer> softMargins = getSoftMargins();
List<Integer> softMargins = getSoftMargins();
serializeInto(softMargins, element);
IndentOptions myIndentOptions = getIndentOptions();
......@@ -154,7 +154,6 @@ public class KotlinCommonCodeStyleSettings extends CommonCodeStyleSettings {
if (setRootSettingsMethod != null) {
// Method was introduced in 173
setRootSettingsMethod.setAccessible(true);
//noinspection IncompatibleAPI
setRootSettingsMethod.invoke(commonSettings, getSoftMargins());
}
}
......@@ -176,7 +175,6 @@ public class KotlinCommonCodeStyleSettings extends CommonCodeStyleSettings {
}
CommonCodeStyleSettings other = (CommonCodeStyleSettings) obj;
//noinspection IncompatibleAPI
if (!getSoftMargins().equals(other.getSoftMargins())) {
return false;
}
......
/*
* 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.compatibility
import com.intellij.openapi.Disposable
import com.intellij.testFramework.fixtures.CodeInsightTestFixture
/**
* Method was introduced in 173 idea. Should be dropped after abandoning 172 branch.
* BUNCH: 173
*/
@Suppress("IncompatibleAPI")
val CodeInsightTestFixture.projectDisposableEx: Disposable get() = projectDisposable
\ No newline at end of file
......@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.asJava.classes.KtLightClassBase
import org.jetbrains.kotlin.asJava.elements.KtLightFieldImpl
import org.jetbrains.kotlin.asJava.elements.KtLightMethodImpl
import org.jetbrains.kotlin.idea.decompiler.classFile.KtClsFile
import org.jetbrains.kotlin.idea.util.qualifiedNameEx
import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtClassOrObject
......@@ -34,7 +33,7 @@ class KtLightClassForDecompiledDeclaration(
override val kotlinOrigin: KtClassOrObject?,
private val file: KtClsFile
) : KtLightClassBase(clsDelegate.manager) {
val fqName = kotlinOrigin?.fqName ?: FqName(clsDelegate.qualifiedNameEx.orEmpty())
val fqName = kotlinOrigin?.fqName ?: FqName(clsDelegate.qualifiedName.orEmpty())
override fun copy() = this
......
......@@ -12,6 +12,7 @@ import com.intellij.psi.search.searches.DirectClassInheritorsSearch
import com.intellij.psi.search.searches.FunctionalExpressionSearch
import com.intellij.psi.search.searches.OverridingMethodsSearch
import com.intellij.psi.util.MethodSignatureUtil
import com.intellij.psi.util.PsiUtil
import com.intellij.psi.util.TypeConversionUtil
import com.intellij.util.EmptyQuery
import com.intellij.util.MergeQuery
......@@ -30,7 +31,6 @@ import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
import org.jetbrains.kotlin.idea.caches.resolve.unsafeResolveToDescriptor
import org.jetbrains.kotlin.idea.core.getDeepestSuperDeclarations
import org.jetbrains.kotlin.idea.core.isOverridable
import org.jetbrains.kotlin.idea.core.util.compat.psi.canBeOverridden
import org.jetbrains.kotlin.idea.search.allScope
import org.jetbrains.kotlin.idea.search.excludeKotlinSources
import org.jetbrains.kotlin.idea.util.application.runReadAction
......@@ -42,7 +42,7 @@ import org.jetbrains.kotlin.util.findCallableMemberBySignature
import java.util.*
fun PsiElement.isOverridableElement(): Boolean = when (this) {
is PsiMethod -> canBeOverridden(this)
is PsiMethod -> PsiUtil.canBeOverridden(this)
is KtDeclaration -> isOverridable()
else -> false
}
......@@ -104,7 +104,7 @@ object KotlinPsiMethodOverridersSearch : HierarchySearch<PsiMethod>(PsiMethodOve
object PsiMethodOverridingHierarchyTraverser: HierarchyTraverser<PsiMethod> {
override fun nextElements(current: PsiMethod): Iterable<PsiMethod> = KotlinPsiMethodOverridersSearch.searchDirectOverriders(current)
override fun shouldDescend(element: PsiMethod): Boolean = canBeOverridden(element)
override fun shouldDescend(element: PsiMethod): Boolean = PsiUtil.canBeOverridden(element)
}
fun PsiElement.toPossiblyFakeLightMethods(): List<PsiMethod> {
......
/*
* 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.util
import com.intellij.psi.impl.compiled.ClsClassImpl
/**
* Nullable wrapper for qualifiedName.
* BUNCH: 173
*/
@Suppress("IncompatibleAPI")
val ClsClassImpl.qualifiedNameEx: String? get() = qualifiedName
\ No newline at end of file
/*
* 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.util.compat.psi
import com.intellij.psi.PsiMethod
import com.intellij.psi.util.PsiUtil
/**
* Method is absent in 172.
* BUNCH: 173
*/
@Suppress("IncompatibleAPI")
fun canBeOverridden(method: PsiMethod): Boolean {
return PsiUtil.canBeOverridden(method)
}
\ No newline at end of file
......@@ -5,13 +5,13 @@
package org.jetbrains.kotlin.idea.formatter
import com.intellij.internal.statistic.AbstractProjectsUsagesCollector
import com.intellij.internal.statistic.beans.GroupDescriptor
import com.intellij.internal.statistic.beans.UsageDescriptor
import com.intellij.internal.statistic.utils.getEnumUsage
import com.intellij.openapi.project.Project
import com.intellij.psi.codeStyle.CodeStyleSettingsManager
import org.jetbrains.kotlin.idea.core.formatter.KotlinCodeStyleSettings
import org.jetbrains.kotlin.idea.util.compat.statistic.AbstractProjectsUsagesCollector
import org.jetbrains.kotlin.idea.util.compat.statistic.getEnumUsage
class KotlinFormatterUsageCollector : AbstractProjectsUsagesCollector() {
override fun getGroupId(): GroupDescriptor = GroupDescriptor.create(GROUP_ID)
......
......@@ -10,7 +10,6 @@ import com.intellij.internal.statistic.UsagesCollector
import com.intellij.internal.statistic.beans.GroupDescriptor
import com.intellij.internal.statistic.beans.UsageDescriptor
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.idea.util.compat.statistic.getBooleanUsage
class KotlinInlayParameterHintsUsageCollector : UsagesCollector() {
override fun getGroupId(): GroupDescriptor = GroupDescriptor.create(GROUP_ID)
......@@ -19,7 +18,7 @@ class KotlinInlayParameterHintsUsageCollector : UsagesCollector() {
val provider = InlayParameterHintsExtension.forLanguage(KotlinLanguage.INSTANCE) ?: return emptySet()
return provider.supportedOptions.mapTo(LinkedHashSet()) {
getBooleanUsage(it.id, it.get())
com.intellij.internal.statistic.utils.getBooleanUsage(it.id, it.get())
}
}
......
/*
* Copyright 2000-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("IncompatibleAPI")
package org.jetbrains.kotlin.idea.util.compat.statistic
/**
* Should be dropped after abandoning 172.
* BUNCH: 173
*/
typealias AbstractProjectsUsagesCollector = com.intellij.internal.statistic.AbstractProjectsUsagesCollector
/**
* Should be dropped after abandoning 172.
* BUNCH: 173
*/
fun getEnumUsage(key: String, value: Enum<*>?) = com.intellij.internal.statistic.utils.getEnumUsage(key, value)
/**
* Should be dropped after abandoning 172.
* BUNCH: 173
*/
fun getBooleanUsage(key: String, value: Boolean) = com.intellij.internal.statistic.utils.getBooleanUsage(key, value)
......@@ -40,7 +40,6 @@ import com.intellij.refactoring.util.occurrences.ExpressionOccurrenceManager
import com.intellij.testFramework.fixtures.CodeInsightTestFixture
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.compatibility.projectDisposableEx
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
import org.jetbrains.kotlin.idea.refactoring.checkConflictsInteractively
......@@ -334,7 +333,7 @@ abstract class AbstractExtractionTest : KotlinLightCodeInsightFixtureTestCase()
protected fun doTest(path: String, checkAdditionalAfterdata: Boolean = false, action: (PsiFile) -> Unit) {
val mainFile = File(path)
PluginTestCaseBase.addJdk(myFixture.projectDisposableEx, PluginTestCaseBase::mockJdk)
PluginTestCaseBase.addJdk(myFixture.projectDisposable, PluginTestCaseBase::mockJdk)
fixture.testDataPath = "${KotlinTestUtils.getHomeDirectory()}/${mainFile.parent}"
......
......@@ -32,7 +32,6 @@ import com.intellij.testFramework.MapDataContext
import com.intellij.testFramework.PsiTestUtil
import com.intellij.testFramework.TestActionEvent
import com.intellij.util.ui.UIUtil
import org.jetbrains.kotlin.compatibility.projectDisposableEx
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.idea.scratch.actions.RunScratchAction
import org.jetbrains.kotlin.idea.scratch.output.InlayScratchFileRenderer
......@@ -165,7 +164,7 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() {
override fun setUp() {
super.setUp()
PluginTestCaseBase.addJdk(myFixture.projectDisposableEx) { PluginTestCaseBase.fullJdk() }
PluginTestCaseBase.addJdk(myFixture.projectDisposable) { PluginTestCaseBase.fullJdk() }
}
override fun tearDown() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册