Use null instead of CompilerMessageLocation.NO_LOCATION in MessageCollector
This commit is contained in:
+1
-2
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.analyzer.common.DefaultAnalyzerFacade
|
||||
import org.jetbrains.kotlin.builtins.BuiltInsBinaryVersion
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
|
||||
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.JvmPackagePartProvider
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
@@ -58,7 +57,7 @@ open class MetadataSerializer(private val dependOnOldBuiltIns: Boolean) {
|
||||
val moduleName = Name.special("<${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>")
|
||||
|
||||
val destDir = configuration.get(CLIConfigurationKeys.METADATA_DESTINATION_DIRECTORY) ?: run {
|
||||
messageCollector.report(CompilerMessageSeverity.ERROR, "Specify destination via -d", CompilerMessageLocation.NO_LOCATION)
|
||||
messageCollector.report(CompilerMessageSeverity.ERROR, "Specify destination via -d")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -75,10 +75,10 @@ class BuiltInsSerializer(dependOnOldBuiltIns: Boolean) : MetadataSerializer(depe
|
||||
private fun createMessageCollector() = object : GroupingMessageCollector(
|
||||
PrintingMessageCollector(System.err, MessageRenderer.PLAIN_RELATIVE_PATHS, /* verbose = */ false)
|
||||
) {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation) {
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
|
||||
// Only report diagnostics without a particular location because there's plenty of errors in built-in sources
|
||||
// (functions without bodies, incorrect combination of modifiers, etc.)
|
||||
if (location.path == null) {
|
||||
if (location == null) {
|
||||
super.report(severity, message, location)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user