[CHERRY PICKED FROM IJ] [refactoring] IdePlatformKind: remove unnecessary generic parameter
It seems that it's not used anymore after 82906a0f35ea13673a8a3b3bfaee94a568eff215 GitOrigin-RevId: 229d3b0573873c2da661712f6fce194816436ca7 Original commit: https://github.com/JetBrains/intellij-community/commit/70e4b14a5a37b8d591df2663725fd1d2c6881628
This commit is contained in:
+1
-1
@@ -29,6 +29,6 @@ fun TargetPlatform?.orDefault(): TargetPlatform {
|
|||||||
return this ?: DefaultIdeTargetPlatformKindProvider.defaultPlatform
|
return this ?: DefaultIdeTargetPlatformKindProvider.defaultPlatform
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IdePlatformKind<*>?.orDefault(): IdePlatformKind<*> {
|
fun IdePlatformKind?.orDefault(): IdePlatformKind {
|
||||||
return this ?: DefaultIdeTargetPlatformKindProvider.defaultPlatform.idePlatformKind
|
return this ?: DefaultIdeTargetPlatformKindProvider.defaultPlatform.idePlatformKind
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.utils.DescriptionAware
|
|||||||
replaceWith = ReplaceWith("TargetPlatform", "org.jetbrains.kotlin.platform.TargetPlatform"),
|
replaceWith = ReplaceWith("TargetPlatform", "org.jetbrains.kotlin.platform.TargetPlatform"),
|
||||||
level = DeprecationLevel.ERROR
|
level = DeprecationLevel.ERROR
|
||||||
)
|
)
|
||||||
abstract class IdePlatform<Kind : IdePlatformKind<Kind>, out Arguments : CommonCompilerArguments> : DescriptionAware {
|
abstract class IdePlatform<Kind : IdePlatformKind, out Arguments : CommonCompilerArguments> : DescriptionAware {
|
||||||
abstract val kind: Kind
|
abstract val kind: Kind
|
||||||
abstract val version: TargetPlatformVersion
|
abstract val version: TargetPlatformVersion
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind
|
|||||||
import org.jetbrains.kotlin.platform.impl.NativeIdePlatformKind
|
import org.jetbrains.kotlin.platform.impl.NativeIdePlatformKind
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
|
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
|
||||||
|
|
||||||
abstract class IdePlatformKind<Kind : IdePlatformKind<Kind>> {
|
abstract class IdePlatformKind {
|
||||||
abstract fun supportsTargetPlatform(platform: TargetPlatform): Boolean
|
abstract fun supportsTargetPlatform(platform: TargetPlatform): Boolean
|
||||||
|
|
||||||
abstract val defaultPlatform: TargetPlatform
|
abstract val defaultPlatform: TargetPlatform
|
||||||
@@ -71,7 +71,7 @@ abstract class IdePlatformKind<Kind : IdePlatformKind<Kind>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val TargetPlatform.idePlatformKind: IdePlatformKind<*>
|
val TargetPlatform.idePlatformKind: IdePlatformKind
|
||||||
get() = IdePlatformKind.ALL_KINDS.filter { it.supportsTargetPlatform(this) }.let { list ->
|
get() = IdePlatformKind.ALL_KINDS.filter { it.supportsTargetPlatform(this) }.let { list ->
|
||||||
when {
|
when {
|
||||||
list.size == 1 -> list.first()
|
list.size == 1 -> list.first()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
|||||||
import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments
|
import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments
|
||||||
import org.jetbrains.kotlin.platform.*
|
import org.jetbrains.kotlin.platform.*
|
||||||
|
|
||||||
object CommonIdePlatformKind : IdePlatformKind<CommonIdePlatformKind>() {
|
object CommonIdePlatformKind : IdePlatformKind() {
|
||||||
override fun supportsTargetPlatform(platform: TargetPlatform) = platform.isCommon()
|
override fun supportsTargetPlatform(platform: TargetPlatform) = platform.isCommon()
|
||||||
|
|
||||||
override fun platformByCompilerArguments(arguments: CommonCompilerArguments): TargetPlatform? {
|
override fun platformByCompilerArguments(arguments: CommonCompilerArguments): TargetPlatform? {
|
||||||
@@ -49,7 +49,7 @@ object CommonIdePlatformKind : IdePlatformKind<CommonIdePlatformKind>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val IdePlatformKind<*>?.isCommon
|
val IdePlatformKind?.isCommon
|
||||||
get() = this is CommonIdePlatformKind
|
get() = this is CommonIdePlatformKind
|
||||||
|
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.platform.TargetPlatformVersion
|
|||||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||||
import org.jetbrains.kotlin.platform.js.isJs
|
import org.jetbrains.kotlin.platform.js.isJs
|
||||||
|
|
||||||
object JsIdePlatformKind : IdePlatformKind<JsIdePlatformKind>() {
|
object JsIdePlatformKind : IdePlatformKind() {
|
||||||
override fun supportsTargetPlatform(platform: TargetPlatform): Boolean = platform.isJs()
|
override fun supportsTargetPlatform(platform: TargetPlatform): Boolean = platform.isJs()
|
||||||
|
|
||||||
override fun platformByCompilerArguments(arguments: CommonCompilerArguments): TargetPlatform? {
|
override fun platformByCompilerArguments(arguments: CommonCompilerArguments): TargetPlatform? {
|
||||||
@@ -55,7 +55,7 @@ object JsIdePlatformKind : IdePlatformKind<JsIdePlatformKind>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val IdePlatformKind<*>?.isJavaScript
|
val IdePlatformKind?.isJavaScript
|
||||||
get() = this is JsIdePlatformKind
|
get() = this is JsIdePlatformKind
|
||||||
|
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import org.jetbrains.kotlin.platform.TargetPlatform
|
|||||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||||
import org.jetbrains.kotlin.platform.jvm.isJvm
|
import org.jetbrains.kotlin.platform.jvm.isJvm
|
||||||
|
|
||||||
object JvmIdePlatformKind : IdePlatformKind<JvmIdePlatformKind>() {
|
object JvmIdePlatformKind : IdePlatformKind() {
|
||||||
override fun supportsTargetPlatform(platform: TargetPlatform): Boolean = platform.isJvm()
|
override fun supportsTargetPlatform(platform: TargetPlatform): Boolean = platform.isJvm()
|
||||||
|
|
||||||
override fun platformByCompilerArguments(arguments: CommonCompilerArguments): TargetPlatform? {
|
override fun platformByCompilerArguments(arguments: CommonCompilerArguments): TargetPlatform? {
|
||||||
@@ -66,7 +66,7 @@ object JvmIdePlatformKind : IdePlatformKind<JvmIdePlatformKind>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val IdePlatformKind<*>?.isJvm
|
val IdePlatformKind?.isJvm
|
||||||
get() = this is JvmIdePlatformKind
|
get() = this is JvmIdePlatformKind
|
||||||
|
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.platform.TargetPlatformVersion
|
|||||||
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
import org.jetbrains.kotlin.platform.konan.NativePlatforms
|
||||||
import org.jetbrains.kotlin.platform.konan.isNative
|
import org.jetbrains.kotlin.platform.konan.isNative
|
||||||
|
|
||||||
object NativeIdePlatformKind : IdePlatformKind<NativeIdePlatformKind>() {
|
object NativeIdePlatformKind : IdePlatformKind() {
|
||||||
override fun supportsTargetPlatform(platform: TargetPlatform): Boolean = platform.isNative()
|
override fun supportsTargetPlatform(platform: TargetPlatform): Boolean = platform.isNative()
|
||||||
|
|
||||||
override fun platformByCompilerArguments(arguments: CommonCompilerArguments): TargetPlatform? {
|
override fun platformByCompilerArguments(arguments: CommonCompilerArguments): TargetPlatform? {
|
||||||
@@ -59,7 +59,7 @@ object NativeIdePlatformKind : IdePlatformKind<NativeIdePlatformKind>() {
|
|||||||
// These are fake compiler arguments for Kotlin/Native - only for usage within IDEA plugin:
|
// These are fake compiler arguments for Kotlin/Native - only for usage within IDEA plugin:
|
||||||
class FakeK2NativeCompilerArguments : CommonCompilerArguments()
|
class FakeK2NativeCompilerArguments : CommonCompilerArguments()
|
||||||
|
|
||||||
val IdePlatformKind<*>?.isKotlinNative
|
val IdePlatformKind?.isKotlinNative
|
||||||
get() = this is NativeIdePlatformKind
|
get() = this is NativeIdePlatformKind
|
||||||
|
|
||||||
@Deprecated(
|
@Deprecated(
|
||||||
|
|||||||
Reference in New Issue
Block a user