JVM: refactor JvmDefaultMode, remove/rename some entries

- remove ENABLE/COMPATIBILITY because they can no longer be used
- remove forAllMethodsWithBody because its behavior is now equivalent to
  isEnabled
- inline isCompatibility
- inline DEFAULT
- rename ALL_INCOMPATIBLE -> ALL
This commit is contained in:
Alexander Udalov
2024-02-01 13:22:48 +01:00
committed by Space Team
parent 6219806ab9
commit 28797a31b4
22 changed files with 58 additions and 85 deletions
@@ -7,29 +7,18 @@ package org.jetbrains.kotlin.config
enum class JvmDefaultMode(val description: String) {
DISABLE("disable"),
ENABLE("enable"),
ENABLE_WITH_DEFAULT_IMPLS("compatibility"),
ALL_COMPATIBILITY("all-compatibility"),
ALL_INCOMPATIBLE("all");
ALL("all");
val isEnabled: Boolean
get() = this != DISABLE
val isCompatibility: Boolean
get() = this == ENABLE_WITH_DEFAULT_IMPLS || this == ALL_COMPATIBILITY
val forAllMethodsWithBody: Boolean
get() = this == ALL_COMPATIBILITY || this == ALL_INCOMPATIBLE
companion object {
@JvmField
val DEFAULT = DISABLE
@JvmStatic
fun fromStringOrNull(string: String?): JvmDefaultMode? = when (string) {
DISABLE.description -> DISABLE
ALL_COMPATIBILITY.description -> ALL_COMPATIBILITY
ALL_INCOMPATIBLE.description -> ALL_INCOMPATIBLE
ALL.description -> ALL
else -> null
}
}