diff options
author | Liam Miller-Cushon <cushon@google.com> | 2015-02-26 02:28:51 +0000 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@google.com> | 2015-02-26 02:28:51 +0000 |
commit | 5e2647085a2d8358d168c59acd9f1c346eaf3cd1 (patch) | |
tree | b093881ea764662264bb3b8014e8c26eec3b8d6b /src/java_tools/buildjar/java | |
parent | aa3b5a9d57107bf87e0d2efd2823f9d683b12828 (diff) |
Delete BlazeJavacLog.
It has been obsolesced by the 'javac-suppress-deferred-diagnostics' javac
feature.
--
MOS_MIGRATED_REVID=87212490
Diffstat (limited to 'src/java_tools/buildjar/java')
2 files changed, 0 insertions, 88 deletions
diff --git a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacLog.java b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacLog.java deleted file mode 100644 index cc79208bd1..0000000000 --- a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacLog.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2014 Google Inc. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.devtools.build.buildjar.javac; - -import com.sun.tools.javac.util.Context; -import com.sun.tools.javac.util.JCDiagnostic; -import com.sun.tools.javac.util.Log; - -/** - * Log class for our custom patched javac. - * - * <p> This log class tweaks the standard javac log class so - * that it drops all non-errors after the first error that - * gets reported. By doing this, we - * ensure that all warnings are listed before all errors in javac's - * output. This makes life easier for everybody. - */ -public class BlazeJavacLog extends Log { - - private boolean hadError = false; - - /** - * Registers a custom BlazeJavacLog for the given context and -Werror spec. - * - * @param context Context - */ - public static void preRegister(final Context context) { - context.put(logKey, new Context.Factory<Log>() { - @Override - public Log make(Context c) { - return new BlazeJavacLog(c); - } - }); - } - - public static BlazeJavacLog instance(Context context) { - return (BlazeJavacLog) context.get(logKey); - } - - BlazeJavacLog(Context context) { - super(context); - } - - /** - * Returns true if we should display the note diagnostic - * passed in as argument, and false if we should discard - * it. - */ - private boolean shouldDisplayNote(JCDiagnostic diag) { - String noteCode = diag.getCode(); - return noteCode == null || - (!noteCode.startsWith("compiler.note.deprecated") && - !noteCode.startsWith("compiler.note.unchecked")); - } - - @Override - protected void writeDiagnostic(JCDiagnostic diag) { - switch (diag.getKind()) { - case NOTE: - if (shouldDisplayNote(diag)) { - super.writeDiagnostic(diag); - } - break; - case ERROR: - hadError = true; - super.writeDiagnostic(diag); - break; - default: - if (!hadError) { - // Do not print further warnings if an error has occured. - super.writeDiagnostic(diag); - } - } - } -} diff --git a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java index 8141051d94..eeb471c0bc 100644 --- a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java +++ b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java @@ -82,7 +82,6 @@ public class BlazeJavacMain { plugin.initializeContext(context); } - BlazeJavacLog.preRegister(context); BlazeJavaCompiler.preRegister(context, plugins); } |