[FIR] Check adding default error messages for all diagnostics ^KT-49973 fixed

Also, check for duplicates
This commit is contained in:
Ivan Kochurkin
2021-11-29 22:47:44 +03:00
committed by Space
parent 9f8387c76a
commit 800d594a4f
14 changed files with 190 additions and 73 deletions
@@ -12,6 +12,10 @@ class KtDiagnosticFactoryToRendererMap(val name: String) {
operator fun get(factory: AbstractKtDiagnosticFactory): KtDiagnosticRenderer? = renderersMap[factory]
fun containsKey(factory: AbstractKtDiagnosticFactory): Boolean {
return renderersMap.containsKey(factory)
}
fun put(factory: KtDiagnosticFactory0, message: String) {
put(factory, SimpleKtDiagnosticRenderer(message))
}
@@ -102,6 +106,9 @@ class KtDiagnosticFactoryToRendererMap(val name: String) {
}
private fun put(factory: AbstractKtDiagnosticFactory, renderer: KtDiagnosticRenderer) {
if (renderersMap.containsKey(factory)) {
throw IllegalStateException("Diagnostic renderer is already initialized for $factory")
}
renderersMap[factory] = renderer
}