Created
May 6, 2018 16:53
-
-
Save belyaev-mikhail/d04bbb22a89c18f377398a70cb1dbced to your computer and use it in GitHub Desktop.
Generate kotlinx.warnings main file from kotlin-compiler-nostrip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args: Array<String>): Unit = runBlocking<Unit> { | |
val warnings = | |
org.jetbrains.kotlin.diagnostics.Errors::class.java.declaredFields | |
.map { it.name to it.get(null) as? DiagnosticFactory<*> } | |
.filter { it.second != null } | |
.filter { it.second?.severity == Severity.WARNING } | |
.map { it.first } | |
.map { """const val $it = "$it" """ } | |
.joinToString("\n") | |
println("package kotlinx.warnings") | |
println() | |
println("object Warnings { ") | |
println(warnings.prependIndent(" ")) | |
println("}") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment