From e9a737b85af105d32b63c7a9b0abfad2c6786ba3 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 27 Jan 2017 16:45:02 +0300 Subject: [PATCH] Promote severity of configuration warnings to STRONG_WARNING The reason is that these configuration problems may be the reason of compilation errors, but they were hidden from the output because warnings are not reported when there's at least one error --- .../org/jetbrains/kotlin/cli/common/CLICompiler.java | 2 +- .../cli/common/messages/AnalyzerWithCompilerReport.kt | 2 +- .../src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt | 4 ++-- .../kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt | 11 +++++------ .../kotlin/cli/metadata/K2MetadataCompiler.kt | 2 +- .../org/jetbrains/kotlin/jps/build/KotlinBuilder.kt | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java index 32f3ddca57a..99f2141a3a6 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLICompiler.java @@ -339,7 +339,7 @@ public abstract class CLICompiler { private void reportUnknownExtraFlags(@NotNull MessageCollector collector, @NotNull A arguments) { for (String flag : arguments.unknownExtraFlags) { collector.report( - CompilerMessageSeverity.WARNING, + CompilerMessageSeverity.STRONG_WARNING, "Flag is not supported by this version of the compiler: " + flag, CompilerMessageLocation.NO_LOCATION ); diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt index ca492e605e3..10bc83602cb 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/messages/AnalyzerWithCompilerReport.kt @@ -206,7 +206,7 @@ class AnalyzerWithCompilerReport(private val messageCollector: MessageCollector) fun reportBytecodeVersionErrors(bindingContext: BindingContext, messageCollector: MessageCollector) { val severity = if (System.getProperty("kotlin.jvm.disable.bytecode.version.error") == "true") - CompilerMessageSeverity.WARNING + CompilerMessageSeverity.STRONG_WARNING else CompilerMessageSeverity.ERROR diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt index 1853321e02a..5a201872da4 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt @@ -152,7 +152,7 @@ class K2JVMCompiler : CLICompiler() { if (destination != null) { messageCollector.report( - CompilerMessageSeverity.WARNING, + CompilerMessageSeverity.STRONG_WARNING, "The '-d' option with a directory destination is ignored because '-module' is specified", CompilerMessageLocation.NO_LOCATION ) @@ -365,7 +365,7 @@ class K2JVMCompiler : CLICompiler() { } else { if (arguments.jdkHome != null) { - messageCollector.report(CompilerMessageSeverity.WARNING, + messageCollector.report(CompilerMessageSeverity.STRONG_WARNING, "The '-jdk-home' option is ignored because '-no-jdk' is specified", CompilerMessageLocation.NO_LOCATION) } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt index 6c3625cf405..b76361fe27d 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt @@ -67,8 +67,7 @@ import org.jetbrains.kotlin.cli.common.CliModuleVisibilityManagerImpl import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity -import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.ERROR -import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.WARNING +import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.* import org.jetbrains.kotlin.cli.common.toBooleanLenient import org.jetbrains.kotlin.cli.jvm.JvmRuntimeVersionsConsistencyChecker import org.jetbrains.kotlin.cli.jvm.config.JavaSourceRoot @@ -217,7 +216,7 @@ class KotlinCoreEnvironment private constructor( FqName(it) } else { - report(WARNING, "Invalid package prefix name is ignored: $it") + report(STRONG_WARNING, "Invalid package prefix name is ignored: $it") null } } @@ -273,7 +272,7 @@ class KotlinCoreEnvironment private constructor( val path = root.file val localFile = findLocalDirectory(path.absolutePath) if (localFile == null) { - report(WARNING, "Classpath entry points to a non-existent location: $path") + report(STRONG_WARNING, "Classpath entry points to a non-existent location: $path") return null } return localFile @@ -286,7 +285,7 @@ class KotlinCoreEnvironment private constructor( val path = root.file val jarFile = applicationEnvironment.jarFileSystem.findFileByPath("$path${URLUtil.JAR_SEPARATOR}") if (jarFile == null) { - report(WARNING, "Classpath entry points to a file that is not a JAR archive: $path") + report(STRONG_WARNING, "Classpath entry points to a file that is not a JAR archive: $path") return null } return jarFile @@ -297,7 +296,7 @@ class KotlinCoreEnvironment private constructor( configuration.kotlinSourceRoots.forEach { path -> if (!uniqueSourceRoots.add(path)) { - report(WARNING, "Duplicate source root: $path") + report(STRONG_WARNING, "Duplicate source root: $path") } } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/K2MetadataCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/K2MetadataCompiler.kt index 9d2048dd6c7..2a28e9b614d 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/K2MetadataCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/metadata/K2MetadataCompiler.kt @@ -65,7 +65,7 @@ class K2MetadataCompiler : CLICompiler() { if (destination.endsWith(".jar")) { // TODO: support .jar destination collector.report( - CompilerMessageSeverity.WARNING, + CompilerMessageSeverity.STRONG_WARNING, ".jar destination is not yet supported, results will be written to the directory with the given name", CompilerMessageLocation.NO_LOCATION ) diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt b/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt index 7c64ef1e7b3..a519d7a1a96 100644 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt +++ b/jps-plugin/src/org/jetbrains/kotlin/jps/build/KotlinBuilder.kt @@ -639,7 +639,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { // We do not support circular dependencies, but if they are present, we do our best should not break the build, // so we simply yield a warning and report NOTHING_DONE environment.messageCollector.report( - WARNING, + STRONG_WARNING, "Circular dependencies are not supported. The following JS modules depend on each other: " + chunk.modules.map { it.name }.joinToString(", ") + ". " + "Kotlin is not compiled for these modules", @@ -690,7 +690,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) { ): OutputItemsCollector? { if (chunk.modules.size > 1) { environment.messageCollector.report( - WARNING, + STRONG_WARNING, "Circular dependencies are only partially supported. The following modules depend on each other: " + chunk.modules.map { it.name }.joinToString(", ") + ". " + "Kotlin will compile them, but some strange effect may happen",