[FE] Make DiagnosticFactory.name not null

This commit is contained in:
Dmitriy Novozhilov
2020-11-26 11:53:07 +03:00
parent 94ce56bfdc
commit db9f301eed
7 changed files with 16 additions and 29 deletions
@@ -34,9 +34,8 @@ class DebugInfoDiagnosticFactory0 private constructor(
return DebugInfoDiagnostic(expression, this)
}
override var name: String?
override val name: String
get() = "DEBUG_INFO_$privateName"
set(_) {}
companion object {
val SMARTCAST = DebugInfoDiagnosticFactory0("SMARTCAST", Severity.INFO)
@@ -51,4 +50,4 @@ class DebugInfoDiagnosticFactory0 private constructor(
val MISSING_UNRESOLVED = DebugInfoDiagnosticFactory0("MISSING_UNRESOLVED")
val DYNAMIC = DebugInfoDiagnosticFactory0("DYNAMIC", Severity.INFO)
}
}
}
@@ -21,9 +21,8 @@ class DebugInfoDiagnosticFactory1 : DiagnosticFactory1<PsiElement, String>,
DebugInfoDiagnosticFactory {
private val privateName: String
override var name: String?
override val name: String
get() = "DEBUG_INFO_$privateName"
set(_) {}
override val withExplicitDefinitionOnly: Boolean
@@ -85,4 +84,4 @@ class DebugInfoDiagnosticFactory1 : DiagnosticFactory1<PsiElement, String>,
return DebugInfoDiagnosticFactory1(name, severity, withExplicitDefinitionOnly)
}
}
}
}
@@ -10,9 +10,8 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticFactory
import org.jetbrains.kotlin.diagnostics.Severity
class SyntaxErrorDiagnosticFactory private constructor() : DiagnosticFactory<SyntaxErrorDiagnostic>(Severity.ERROR) {
override var name: String?
override val name: String
get() = "SYNTAX"
set(_) {}
companion object {
val INSTANCE = SyntaxErrorDiagnosticFactory()
@@ -1199,7 +1199,7 @@ public interface Errors {
Object value = field.get(null);
if (value instanceof DiagnosticFactory) {
DiagnosticFactory<?> factory = (DiagnosticFactory<?>)value;
factory.setName(field.getName());
factory.initializeName(field.getName());
factory.setDefaultRenderer((DiagnosticRenderer) diagnosticToRendererMap.get(factory));
}