Rename Jsr305State -> JavaTypeEnhancementState

Also, rename some of the properties
It's needed to store status for codeanalysis annotation in that class
This commit is contained in:
Denis Zharkov
2019-08-14 12:54:55 +03:00
committed by Victor Petukhov
parent 2f04a1505d
commit 6c37574fce
22 changed files with 109 additions and 95 deletions
+2
View File
@@ -6,6 +6,8 @@ plugins {
dependencies {
api(kotlinStdlib())
api(project(":compiler:compiler.version"))
compile(project(":core:deserialization"))
compileOnly(project(":kotlin-reflect-api"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
compileOnly(intellijDep()) { includeIntellijCoreJarDependencies(project) }
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.config
import org.jetbrains.kotlin.utils.JavaTypeEnhancementState
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
@@ -33,6 +34,14 @@ class AnalysisFlag<out T> internal constructor(
operator fun provideDelegate(instance: Any?, property: KProperty<*>) = Delegate(property.name, ExplicitApiMode.DISABLED)
}
object Jsr305StateWarnByDefault {
operator fun provideDelegate(instance: Any?, property: KProperty<*>) = Delegate(property.name, JavaTypeEnhancementState.DEFAULT)
}
object JvmDefaultModeDisabledByDefault {
operator fun provideDelegate(instance: Any?, property: KProperty<*>) = Delegate(property.name, JvmDefaultMode.DISABLE)
}
object ListOfStrings {
operator fun provideDelegate(instance: Any?, property: KProperty<*>) = Delegate(property.name, emptyList<String>())
}
@@ -0,0 +1,31 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.config
enum class JvmDefaultMode(val description: String) {
DISABLE("disable"),
ENABLE("enable"),
ENABLE_WITH_DEFAULT_IMPLS("compatibility"),
ALL_COMPATIBILITY("all-compatibility"),
ALL_INCOMPATIBLE("all");
val isEnabled
get() = this != DISABLE
val isCompatibility
get() = this == ENABLE_WITH_DEFAULT_IMPLS || this == ALL_COMPATIBILITY
val forAllMethodsWithBody
get() = this == ALL_COMPATIBILITY || this == ALL_INCOMPATIBLE
companion object {
@JvmField
val DEFAULT = DISABLE
@JvmStatic
fun fromStringOrNull(string: String?) = values().find { it.description == string }
}
}