Rename MessageRenderer constants
This commit is contained in:
+1
-4
@@ -27,9 +27,7 @@ public class MessageCollectorPlainTextToStream implements MessageCollector {
|
||||
|
||||
public static final MessageCollector PLAIN_TEXT_TO_SYSTEM_ERR = new MessageCollectorPlainTextToStream(System.err, NON_VERBOSE);
|
||||
|
||||
@NotNull
|
||||
private final PrintStream stream;
|
||||
@NotNull
|
||||
private final Set<CompilerMessageSeverity> severitiesToPrint;
|
||||
|
||||
public MessageCollectorPlainTextToStream(@NotNull PrintStream stream, @NotNull Set<CompilerMessageSeverity> severities) {
|
||||
@@ -40,8 +38,7 @@ public class MessageCollectorPlainTextToStream implements MessageCollector {
|
||||
@Override
|
||||
public void report(@NotNull CompilerMessageSeverity severity, @NotNull String message, @NotNull CompilerMessageLocation location) {
|
||||
if (severitiesToPrint.contains(severity)) {
|
||||
stream.println(MessageRenderer.PLAIN.render(severity, message, location));
|
||||
stream.println(MessageRenderer.PLAIN_FULL_PATHS.render(severity, message, location));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-3
@@ -25,7 +25,7 @@ import java.io.File;
|
||||
|
||||
public interface MessageRenderer {
|
||||
|
||||
MessageRenderer TAGS = new MessageRenderer() {
|
||||
MessageRenderer XML = new MessageRenderer() {
|
||||
@Override
|
||||
public String renderPreamble() {
|
||||
return "<MESSAGES>";
|
||||
@@ -58,7 +58,7 @@ public interface MessageRenderer {
|
||||
}
|
||||
};
|
||||
|
||||
MessageRenderer PLAIN = new PlainText() {
|
||||
MessageRenderer PLAIN_FULL_PATHS = new PlainText() {
|
||||
@Nullable
|
||||
@Override
|
||||
protected String getPath(@NotNull CompilerMessageLocation location) {
|
||||
@@ -66,7 +66,7 @@ public interface MessageRenderer {
|
||||
}
|
||||
};
|
||||
|
||||
MessageRenderer PLAIN_WITH_RELATIVE_PATH = new PlainText() {
|
||||
MessageRenderer PLAIN_RELATIVE_PATHS = new PlainText() {
|
||||
private final File cwd = new File(".").getAbsoluteFile();
|
||||
|
||||
@Nullable
|
||||
@@ -102,6 +102,8 @@ public interface MessageRenderer {
|
||||
}
|
||||
|
||||
String renderPreamble();
|
||||
|
||||
String render(@NotNull CompilerMessageSeverity severity, @NotNull String message, @NotNull CompilerMessageLocation location);
|
||||
|
||||
String renderConclusion();
|
||||
}
|
||||
|
||||
@@ -49,19 +49,19 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
|
||||
|
||||
@NotNull
|
||||
public ExitCode exec(@NotNull PrintStream errStream, @NotNull String... args) {
|
||||
return exec(errStream, Services.EMPTY, MessageRenderer.PLAIN_WITH_RELATIVE_PATH, args);
|
||||
return exec(errStream, Services.EMPTY, MessageRenderer.PLAIN_RELATIVE_PATHS, args);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration") // Used via reflection in CompilerRunnerUtil#invokeExecMethod
|
||||
@NotNull
|
||||
public ExitCode execAndOutputHtml(@NotNull PrintStream errStream, @NotNull Services services, @NotNull String... args) {
|
||||
return exec(errStream, services, MessageRenderer.TAGS, args);
|
||||
return exec(errStream, services, MessageRenderer.XML, args);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration") // Used via reflection in KotlinCompilerBaseTask
|
||||
@NotNull
|
||||
public ExitCode execFullPathsInMessages(@NotNull PrintStream errStream, @NotNull String[] args) {
|
||||
return exec(errStream, Services.EMPTY, MessageRenderer.PLAIN, args);
|
||||
return exec(errStream, Services.EMPTY, MessageRenderer.PLAIN_FULL_PATHS, args);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -41,7 +41,7 @@ public abstract class AbstractModuleXmlParserTest extends TestCase {
|
||||
public void report(
|
||||
@NotNull CompilerMessageSeverity severity, @NotNull String message, @NotNull CompilerMessageLocation location
|
||||
) {
|
||||
throw new AssertionError(MessageRenderer.PLAIN.render(severity, message, location));
|
||||
throw new AssertionError(MessageRenderer.PLAIN_FULL_PATHS.render(severity, message, location));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user