Introduce CompilerMessageSeverity.STRONG_WARNING

This is a severity for mandatory warnings, i.e. those which should be reported
in any case, even if there are compilation errors
This commit is contained in:
Alexander Udalov
2017-01-27 16:40:12 +03:00
parent 268d10d3f0
commit 7ac96163ac
8 changed files with 60 additions and 22 deletions
@@ -16,13 +16,16 @@
package org.jetbrains.kotlin.cli.common.messages;
import org.jetbrains.annotations.NotNull;
import java.util.EnumSet;
public enum CompilerMessageSeverity {
INFO,
ERROR,
WARNING,
EXCEPTION,
ERROR,
STRONG_WARNING,
WARNING,
INFO,
LOGGING,
OUTPUT;
@@ -32,4 +35,25 @@ public enum CompilerMessageSeverity {
public boolean isError() {
return ERRORS.contains(this);
}
@NotNull
public String getPresentableName() {
switch (this) {
case EXCEPTION:
return "exception";
case ERROR:
return "error";
case STRONG_WARNING:
case WARNING:
return "warning";
case INFO:
return "info";
case LOGGING:
return "logging";
case OUTPUT:
return "output";
default:
throw new UnsupportedOperationException("Unknown severity: " + this);
}
}
}
@@ -68,7 +68,7 @@ public class GroupingMessageCollector implements MessageCollector {
for (String path : sortedKeys()) {
for (Message message : groupedMessages.get(path)) {
if (!hasErrors || message.severity.isError()) {
if (!hasErrors || message.severity.isError() || message.severity == CompilerMessageSeverity.STRONG_WARNING) {
delegate.report(message.severity, message.message, message.location);
}
}