[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
@@ -9,9 +9,15 @@ import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticRenderer
import java.lang.IllegalArgumentException
abstract class DiagnosticFactory<D : UnboundDiagnostic> protected constructor(
open var name: String?,
private var _name: String?,
open val severity: Severity
) {
open val name: String
get() = _name!!
fun initializeName(name: String) {
_name = name
}
open var defaultRenderer: DiagnosticRenderer<D>? = null
@@ -29,7 +35,7 @@ abstract class DiagnosticFactory<D : UnboundDiagnostic> protected constructor(
}
override fun toString(): String {
return name ?: "<Anonymous DiagnosticFactory>"
return _name ?: "<Anonymous DiagnosticFactory>"
}
companion object {
@@ -45,4 +51,4 @@ abstract class DiagnosticFactory<D : UnboundDiagnostic> protected constructor(
throw IllegalArgumentException("Factory mismatch: expected one of " + factories + " but was " + diagnostic.factory)
}
}
}
}