[kotlin] API cleanup: remove unused deprecated API (IJPL-275)

GitOrigin-RevId: eb8a3bafe5fb32fc4ed97add71573ed0ed773451
This commit is contained in:
Nikolay Chashnikov
2024-01-10 16:32:57 +01:00
committed by intellij-monorepo-bot
parent e549b63cec
commit b89d4f076d
12 changed files with 0 additions and 186 deletions

View File

@@ -3,15 +3,11 @@
package org.jetbrains.kotlin.idea.project
import com.intellij.openapi.module.Module
import com.intellij.psi.PsiElement
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.idea.base.facet.platform.platform as platformNew
import org.jetbrains.kotlin.idea.base.projectStructure.languageVersionSettings as languageVersionSettingsNew
val KtElement.builtIns: KotlinBuiltIns get() = getResolutionFacade().moduleDescriptor.builtIns
@@ -31,14 +27,3 @@ val Module.platform: TargetPlatform
@Suppress("unused")
val KtElement.platform: TargetPlatform
get() = platformNew
@get:ApiStatus.ScheduledForRemoval
@get:Deprecated("Use 'org.jetbrains.kotlin.idea.base.projectStructure.languageVersionSettings' instead")
@Deprecated(
"Use 'org.jetbrains.kotlin.idea.base.projectStructure.languageVersionSettings' instead",
ReplaceWith("languageVersionSettings", "org.jetbrains.kotlin.idea.base.projectStructure.languageVersionSettings"),
level = DeprecationLevel.ERROR
)
@Suppress("unused")
val PsiElement.languageVersionSettings: LanguageVersionSettings
get() = languageVersionSettingsNew

View File

@@ -4,7 +4,6 @@ package org.jetbrains.kotlin.idea.caches.project
import com.intellij.openapi.module.Module
import com.intellij.psi.PsiElement
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.kotlin.analyzer.ModuleInfo
import org.jetbrains.kotlin.caches.resolve.KotlinCacheService
import org.jetbrains.kotlin.config.KotlinSourceRootType
@@ -24,7 +23,6 @@ import org.jetbrains.kotlin.idea.base.projectStructure.testSourceInfo
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.isCommon
import org.jetbrains.kotlin.types.typeUtil.closure
import org.jetbrains.kotlin.idea.base.facet.implementingModules as implementingModulesNew
@Deprecated(
"Use 'org.jetbrains.kotlin.idea.base.facet.isNewMultiPlatformModule' instead.",
@@ -57,17 +55,6 @@ val Module.sourceType: SourceType?
val Module.isMPPModule: Boolean
get() = isMultiPlatformModule
@get:ApiStatus.ScheduledForRemoval
@get:Deprecated("Use 'org.jetbrains.kotlin.idea.base.facet.implementingModules' instead.")
@Deprecated(
"Use 'org.jetbrains.kotlin.idea.base.facet.implementingModules' instead.",
ReplaceWith("implementingModules", imports = ["org.jetbrains.kotlin.idea.base.facet"]),
level = DeprecationLevel.ERROR
)
@Suppress("unused")
val Module.implementingModules: List<Module>
get() = implementingModulesNew
val ModuleDescriptor.implementingDescriptors: List<ModuleDescriptor>
get() {
val moduleInfo = getCapability(ModuleInfo.Capability)

View File

@@ -1,28 +0,0 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.core.util
import com.intellij.openapi.util.NlsSafe
import com.intellij.psi.PsiElement
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import javax.swing.Icon
import org.jetbrains.kotlin.idea.base.fe10.codeInsight.DescriptorMemberChooserObject as DescriptorMemberChooserObjectNew
@Suppress("unused")
@ApiStatus.ScheduledForRemoval
@Deprecated("Use 'org.jetbrains.kotlin.idea.base.fe10.codeInsight.DescriptorMemberChooserObject' instead")
open class DescriptorMemberChooserObject(
psiElement: PsiElement,
descriptor: DeclarationDescriptor
) : DescriptorMemberChooserObjectNew(psiElement, descriptor) {
companion object {
@NlsSafe
fun getText(descriptor: DeclarationDescriptor): String {
return DescriptorMemberChooserObjectNew.getText(descriptor)
}
fun getIcon(declaration: PsiElement?, descriptor: DeclarationDescriptor): Icon? {
return DescriptorMemberChooserObjectNew.getIcon(declaration, descriptor)
}
}
}

View File

@@ -1,19 +0,0 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.Nls
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.util.AbstractKotlinBundle
import org.jetbrains.kotlin.idea.base.resources.BUNDLE as _BUNDLE
import org.jetbrains.kotlin.idea.base.resources.KotlinBundle as _KotlinBundle
@ApiStatus.ScheduledForRemoval
@Deprecated("Please use org.jetbrains.kotlin.idea.base.resources.KotlinBundle instead")
object KotlinBundle: AbstractKotlinBundle(_BUNDLE) {
@Nls
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = _BUNDLE) key: String, vararg params: Any): String =
_KotlinBundle.message(key, params)
}

View File

@@ -1,32 +0,0 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:Suppress("DeprecatedCallableAddReplaceWith")
package org.jetbrains.kotlin.idea.util
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.Project
import org.jetbrains.annotations.ApiStatus
@ApiStatus.ScheduledForRemoval
@Deprecated("Use org.jetbrains.kotlin.idea.base.util.runReadActionInSmartMode()")
fun <T> Project.runReadActionInSmartMode(action: () -> T): T {
if (ApplicationManager.getApplication().isReadAccessAllowed) return action()
return DumbService.getInstance(this).runReadActionInSmartMode<T>(action)
}
@ApiStatus.ScheduledForRemoval
@Deprecated("Use org.jetbrains.kotlin.idea.base.util.runWithAlternativeResolveEnabled()")
fun <T> Project.runWithAlternativeResolveEnabled(action: () -> T): T {
@Suppress("UNCHECKED_CAST") var result: T = null as T
DumbService.getInstance(this).withAlternativeResolveEnabled { result = action() }
@Suppress("USELESS_CAST")
return result as T
}
@ApiStatus.ScheduledForRemoval
@Deprecated("Use org.jetbrains.kotlin.idea.base.util.runWhenSmart()")
fun Project.runWhenSmart(action: () -> Unit) {
DumbService.getInstance(this).runWhenSmart(action)
}

View File

@@ -32,15 +32,6 @@ interface ModuleSourceInfo : OldModuleSourceInfo, IdeaModuleInfo, TrackableModul
override val platform: TargetPlatform
get() = module.platform
@Suppress("DEPRECATION_ERROR")
@ApiStatus.ScheduledForRemoval
@Deprecated(
message = "This accessor is deprecated and will be removed soon, use API from 'org.jetbrains.kotlin.platform.*' packages instead",
replaceWith = ReplaceWith("platform"),
level = DeprecationLevel.ERROR
)
fun getPlatform(): org.jetbrains.kotlin.resolve.TargetPlatform = platform.toOldPlatform()
override val analyzerServices: PlatformDependentAnalyzerServices
get() = platform.findAnalyzerServices(module.project)

View File

@@ -4,7 +4,6 @@ package org.jetbrains.kotlin.idea.codeinsight.api.classic.intentions
import com.intellij.codeInspection.util.IntentionFamilyName
import com.intellij.codeInspection.util.IntentionName
import com.intellij.openapi.util.TextRange
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.kotlin.psi.KtElement
abstract class SelfTargetingOffsetIndependentIntention<TElement : KtElement>(
@@ -12,17 +11,6 @@ abstract class SelfTargetingOffsetIndependentIntention<TElement : KtElement>(
textGetter: () -> @IntentionName String,
familyNameGetter: () -> @IntentionFamilyName String = textGetter,
) : SelfTargetingRangeIntention<TElement>(elementType, textGetter, familyNameGetter) {
@ApiStatus.ScheduledForRemoval
@Deprecated(
"Replace with primary constructor",
ReplaceWith("SelfTargetingOffsetIndependentIntention<TElement>(elementType, { text }, { familyName })")
)
constructor(
elementType: Class<TElement>,
text: @IntentionName String,
familyName: @IntentionFamilyName String = text,
) : this(elementType, { text }, { familyName })
abstract fun isApplicableTo(element: TElement): Boolean
final override fun applicabilityRange(element: TElement): TextRange? {

View File

@@ -221,22 +221,6 @@ fun detectPlatformKindByPlugin(moduleNode: DataNode<ModuleData>): IdePlatformKin
return IdePlatformKind.ALL_KINDS.firstOrNull { it.tooling.gradlePluginId == pluginId }
}
@Suppress("DEPRECATION_ERROR")
@ApiStatus.ScheduledForRemoval
@Deprecated(
"Use detectPlatformKindByPlugin() instead",
replaceWith = ReplaceWith("detectPlatformKindByPlugin(moduleNode)"),
level = DeprecationLevel.ERROR
)
fun detectPlatformByPlugin(moduleNode: DataNode<ModuleData>): TargetPlatformKind<*>? {
return when (moduleNode.kotlinGradleProjectDataOrFail.platformPluginId) {
"kotlin-platform-jvm" -> TargetPlatformKind.Jvm[JvmTarget.DEFAULT]
"kotlin-platform-js" -> TargetPlatformKind.JavaScript
"kotlin-platform-common" -> TargetPlatformKind.Common
else -> null
}
}
internal fun detectPlatformByLibrary(moduleNode: DataNode<ModuleData>): IdePlatformKind? {
val detectedPlatforms =
mavenLibraryIdToPlatform.entries

View File

@@ -62,13 +62,6 @@ class ProjectInfo(
private var allModulesAsserter: (ModuleInfo.() -> Unit)? = null
private val moduleInfos = moduleManager.modules.associateWith { module -> ModuleInfo(module, this) }
@ApiStatus.ScheduledForRemoval
@Deprecated("Use .forEachModule instead. This method is error prone and has to be called before 'module(..)' in order to run")
fun allModules(body: ModuleInfo.() -> Unit) {
assert(allModulesAsserter == null)
allModulesAsserter = body
}
fun forEachModule(body: ModuleInfo.() -> Unit) {
moduleInfos.values.forEach { moduleInfo ->
moduleInfo.run(body)

View File

@@ -3,9 +3,7 @@ package org.jetbrains.kotlin.idea.configuration
import com.intellij.facet.FacetManager
import com.intellij.openapi.externalSystem.model.ProjectSystemId
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
import com.intellij.openapi.module.Module
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.kotlin.idea.base.util.isGradleModule
val GRADLE_SYSTEM_ID = ProjectSystemId("GRADLE")
@@ -21,13 +19,3 @@ class GradleDetector : BuildSystemTypeDetector {
return null
}
}
@ApiStatus.ScheduledForRemoval
@Deprecated(
"Moved to the 'org.jetbrains.kotlin.idea.base.util' package.",
level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith("org.jetbrains.kotlin.idea.base.util.isGradleModule()")
)
fun Module.isGradleModule(): Boolean {
return ExternalSystemApiUtil.isExternalSystemAwareModule(GRADLE_SYSTEM_ID, this)
}

View File

@@ -3,16 +3,6 @@
package org.jetbrains.kotlin.idea.framework
import com.intellij.openapi.externalSystem.model.ProjectSystemId
import org.jetbrains.annotations.ApiStatus
val MAVEN_SYSTEM_ID = ProjectSystemId("Maven")
@get:ApiStatus.ScheduledForRemoval
@get:Deprecated("Moved to the org.jetbrains.kotlin.idea.configuration package.")
@Deprecated(
"Moved to the org.jetbrains.kotlin.idea.configuration package.",
level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith("org.jetbrains.kotlin.idea.configuration.GRADLE_SYSTEM_ID")
)
val GRADLE_SYSTEM_ID: ProjectSystemId
get() = org.jetbrains.kotlin.idea.configuration.GRADLE_SYSTEM_ID

View File

@@ -579,19 +579,6 @@ class KotlinPositionManager(private val debugProcess: DebugProcess) : MultiReque
}
}
@ApiStatus.ScheduledForRemoval
@Deprecated("Use 'ClassNameProvider' directly")
fun originalClassNamesForPosition(position: SourcePosition): List<String> {
return runReadAction {
val classNameProvider = ClassNameProvider(
debugProcess.project,
debugProcess.searchScope,
ClassNameProvider.Configuration.DEFAULT.copy(findInlineUseSites = false)
)
classNameProvider.getCandidates(position)
}
}
override fun locationsOfLine(type: ReferenceType, position: SourcePosition): List<Location> {
if (position.file !is KtFile) {
throw NoDataException.INSTANCE