Refactor diagnostic & result reporters...
to better reflect actual roles
This commit is contained in:
+6
-6
@@ -5,16 +5,16 @@
|
||||
|
||||
package org.jetbrains.kotlin.diagnostics
|
||||
|
||||
import org.jetbrains.kotlin.diagnostics.impl.BaseDiagnosticReporter
|
||||
import org.jetbrains.kotlin.diagnostics.impl.DiagnosticReporterWithSuppress
|
||||
import org.jetbrains.kotlin.diagnostics.impl.SimpleDiagnosticReporter
|
||||
import org.jetbrains.kotlin.diagnostics.impl.BaseDiagnosticsCollector
|
||||
import org.jetbrains.kotlin.diagnostics.impl.DiagnosticsCollectorWithSuppress
|
||||
import org.jetbrains.kotlin.diagnostics.impl.SimpleDiagnosticsCollector
|
||||
|
||||
object DiagnosticReporterFactory {
|
||||
fun createReporter(disableSuppress: Boolean = false): BaseDiagnosticReporter {
|
||||
fun createReporter(disableSuppress: Boolean = false): BaseDiagnosticsCollector {
|
||||
return if (disableSuppress) {
|
||||
SimpleDiagnosticReporter()
|
||||
SimpleDiagnosticsCollector()
|
||||
} else {
|
||||
DiagnosticReporterWithSuppress()
|
||||
DiagnosticsCollectorWithSuppress()
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.diagnostics.impl
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.diagnostics.KtDiagnostic
|
||||
|
||||
abstract class BaseDiagnosticReporter : DiagnosticReporter() {
|
||||
abstract class BaseDiagnosticsCollector : DiagnosticReporter() {
|
||||
abstract val diagnostics: List<KtDiagnostic>
|
||||
abstract val diagnosticsByFilePath: Map<String?, List<KtDiagnostic>>
|
||||
abstract val hasErrors: Boolean
|
||||
+1
-1
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticContext
|
||||
import org.jetbrains.kotlin.diagnostics.KtDiagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
|
||||
class DiagnosticReporterWithSuppress : BaseDiagnosticReporter() {
|
||||
class DiagnosticsCollectorWithSuppress : BaseDiagnosticsCollector() {
|
||||
private val _diagnosticsByFilePath: MutableMap<String?, MutableList<KtDiagnostic>> = mutableMapOf()
|
||||
override val diagnostics: List<KtDiagnostic>
|
||||
get() = _diagnosticsByFilePath.flatMap { it.value }
|
||||
+1
-1
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticContext
|
||||
import org.jetbrains.kotlin.diagnostics.KtDiagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
|
||||
class SimpleDiagnosticReporter : BaseDiagnosticReporter() {
|
||||
class SimpleDiagnosticsCollector : BaseDiagnosticsCollector() {
|
||||
private val _diagnosticsByFilePath: MutableMap<String?, MutableList<KtDiagnostic>> = mutableMapOf()
|
||||
override val diagnostics: List<KtDiagnostic>
|
||||
get() = _diagnosticsByFilePath.flatMap { it.value }
|
||||
Reference in New Issue
Block a user