From d80c1ad10d93ccc4cf58f117cbb985fb2f78479d Mon Sep 17 00:00:00 2001 From: Alexey Tsvetkov Date: Tue, 27 Dec 2016 11:26:33 +0300 Subject: [PATCH] Add integer value to compiler message severity --- .../messages/CompilerMessageSeverity.java | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/messages/CompilerMessageSeverity.java b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/messages/CompilerMessageSeverity.java index cf49c63311b..558c398f873 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/messages/CompilerMessageSeverity.java +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/messages/CompilerMessageSeverity.java @@ -19,12 +19,30 @@ package org.jetbrains.kotlin.cli.common.messages; import java.util.EnumSet; public enum CompilerMessageSeverity { - INFO, - ERROR, - WARNING, - EXCEPTION, - LOGGING, - OUTPUT; + ERROR(0), + EXCEPTION(5), + WARNING(10), + INFO(15), + OUTPUT(20), + LOGGING(25); + + private final int value; + + CompilerMessageSeverity(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + static CompilerMessageSeverity fromValue(int value) { + for (CompilerMessageSeverity severity : CompilerMessageSeverity.values()) { + if (severity.value == value) return severity; + } + + return null; + } public static final EnumSet ERRORS = EnumSet.of(ERROR, EXCEPTION); public static final EnumSet VERBOSE = EnumSet.of(OUTPUT, LOGGING);