Explicit Api mode: prototype with check for missing explicit visibility

Add cli flag with 3-state switch
This commit is contained in:
Leonid Startsev
2019-05-24 15:18:23 +03:00
parent a7d60fbf2d
commit 7058492b55
10 changed files with 109 additions and 0 deletions
@@ -38,6 +38,10 @@ class AnalysisFlag<out T> internal constructor(
operator fun provideDelegate(instance: Any?, property: KProperty<*>) = Delegate(property.name, JvmDefaultMode.DISABLE)
}
object ApiModeDisabledByDefault {
operator fun provideDelegate(instance: Any?, property: KProperty<*>) = Delegate(property.name, ApiMode.DISABLED)
}
object ListOfStrings {
operator fun provideDelegate(instance: Any?, property: KProperty<*>) = Delegate(property.name, emptyList<String>())
}
@@ -0,0 +1,18 @@
/*
* Copyright 2010-2019 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 ApiMode(val state: String) {
DISABLED("disable"),
ENABLED("enable"),
MIGRATION("migration");
companion object {
fun fromString(string: String): ApiMode? = values().find { it.state == string }
fun availableValues() = values().joinToString(prefix = "{", postfix = "}") { it.state }
}
}