Use null instead of CompilerMessageLocation.NO_LOCATION in MessageCollector
This commit is contained in:
+6
-9
@@ -21,8 +21,8 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
|
||||
import org.jetbrains.kotlin.daemon.common.*
|
||||
import java.io.Serializable
|
||||
import java.io.File
|
||||
import java.io.Serializable
|
||||
import java.rmi.server.UnicastRemoteObject
|
||||
|
||||
|
||||
@@ -51,11 +51,11 @@ fun MessageCollector.reportFromDaemon(outputsCollector: ((File, List<File>) -> U
|
||||
}
|
||||
}
|
||||
else {
|
||||
report(CompilerMessageSeverity.OUTPUT, message!!, CompilerMessageLocation.NO_LOCATION)
|
||||
report(CompilerMessageSeverity.OUTPUT, message!!)
|
||||
}
|
||||
}
|
||||
ReportCategory.EXCEPTION -> {
|
||||
report(CompilerMessageSeverity.EXCEPTION, message.orEmpty(), CompilerMessageLocation.NO_LOCATION)
|
||||
report(CompilerMessageSeverity.EXCEPTION, message.orEmpty())
|
||||
}
|
||||
ReportCategory.COMPILER_MESSAGE -> {
|
||||
val compilerSeverity = when (ReportSeverity.fromCode(severity)) {
|
||||
@@ -65,7 +65,7 @@ fun MessageCollector.reportFromDaemon(outputsCollector: ((File, List<File>) -> U
|
||||
ReportSeverity.DEBUG -> CompilerMessageSeverity.LOGGING
|
||||
else -> throw IllegalStateException("Unexpected compiler message report severity $severity")
|
||||
}
|
||||
if (message != null && attachment is CompilerMessageLocation) {
|
||||
if (message != null && attachment is CompilerMessageLocation?) {
|
||||
report(compilerSeverity, message, attachment)
|
||||
}
|
||||
else {
|
||||
@@ -75,7 +75,7 @@ fun MessageCollector.reportFromDaemon(outputsCollector: ((File, List<File>) -> U
|
||||
ReportCategory.DAEMON_MESSAGE,
|
||||
ReportCategory.IC_MESSAGE -> {
|
||||
if (message != null) {
|
||||
report(CompilerMessageSeverity.LOGGING, message, CompilerMessageLocation.NO_LOCATION)
|
||||
report(CompilerMessageSeverity.LOGGING, message)
|
||||
}
|
||||
else {
|
||||
reportUnexpected(category, severity, message, attachment)
|
||||
@@ -95,8 +95,5 @@ private fun MessageCollector.reportUnexpected(category: Int, severity: Int, mess
|
||||
else -> CompilerMessageSeverity.LOGGING
|
||||
}
|
||||
|
||||
report(compilerMessageSeverity,
|
||||
"Unexpected message: category=$category; severity=$severity; message='$message'; attachment=$attachment",
|
||||
CompilerMessageLocation.NO_LOCATION)
|
||||
report(compilerMessageSeverity, "Unexpected message: category=$category; severity=$severity; message='$message'; attachment=$attachment")
|
||||
}
|
||||
|
||||
|
||||
+8
-10
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon.client
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.daemon.common.*
|
||||
@@ -33,7 +32,6 @@ import java.rmi.UnmarshalException
|
||||
import java.rmi.server.UnicastRemoteObject
|
||||
import java.util.concurrent.Semaphore
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.comparisons.compareByDescending
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class CompilationServices(
|
||||
@@ -343,17 +341,17 @@ object KotlinCompilerClient {
|
||||
messages?.add(DaemonReportMessage(category, "[$source] $message"))
|
||||
messageCollector?.let {
|
||||
when (category) {
|
||||
DaemonReportCategory.DEBUG -> it.report(CompilerMessageSeverity.LOGGING, message, CompilerMessageLocation.NO_LOCATION)
|
||||
DaemonReportCategory.INFO -> it.report(CompilerMessageSeverity.INFO, message, CompilerMessageLocation.NO_LOCATION)
|
||||
DaemonReportCategory.EXCEPTION -> it.report(CompilerMessageSeverity.EXCEPTION, message, CompilerMessageLocation.NO_LOCATION)
|
||||
DaemonReportCategory.DEBUG -> it.report(CompilerMessageSeverity.LOGGING, message)
|
||||
DaemonReportCategory.INFO -> it.report(CompilerMessageSeverity.INFO, message)
|
||||
DaemonReportCategory.EXCEPTION -> it.report(CompilerMessageSeverity.EXCEPTION, message)
|
||||
}
|
||||
}
|
||||
compilerServices?.let {
|
||||
when (category) {
|
||||
DaemonReportCategory.DEBUG -> it.report(ReportCategory.DAEMON_MESSAGE, ReportSeverity.DEBUG, message, source)
|
||||
DaemonReportCategory.INFO -> it.report(ReportCategory.DAEMON_MESSAGE, ReportSeverity.INFO, message, source)
|
||||
DaemonReportCategory.EXCEPTION -> it.report(ReportCategory.EXCEPTION, ReportSeverity.ERROR, message, source)
|
||||
}
|
||||
when (category) {
|
||||
DaemonReportCategory.DEBUG -> it.report(ReportCategory.DAEMON_MESSAGE, ReportSeverity.DEBUG, message, source)
|
||||
DaemonReportCategory.INFO -> it.report(ReportCategory.DAEMON_MESSAGE, ReportSeverity.INFO, message, source)
|
||||
DaemonReportCategory.EXCEPTION -> it.report(ReportCategory.EXCEPTION, ReportSeverity.ERROR, message, source)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user