Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: third_party/errorprone/src/org/chromium/errorprone/ChromiumErrorProneCompiler.java

Issue 1136573002: Use the Errorprone Compiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Full Sync and Update Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/errorprone/errorprone.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.errorprone;
6
7 import com.google.errorprone.BugPattern;
8 import com.google.errorprone.ErrorProneOptions;
9 import com.google.errorprone.ErrorProneScanner;
10 import com.google.errorprone.ErrorReportingJavaCompiler;
11 import com.google.errorprone.JDKCompatible;
12 import com.google.errorprone.Scanner;
13 import com.google.errorprone.bugpatterns.BugChecker;
14
15 import com.sun.tools.javac.file.JavacFileManager;
16 import com.sun.tools.javac.main.Main;
17 import com.sun.tools.javac.util.Context;
18 import com.sun.tools.javac.util.List;
19
20 import java.io.PrintWriter;
21 import java.util.HashSet;
22 import java.util.Set;
23
24 import javax.tools.JavaFileObject;
25
26 /**
27 * Configures (and compiles with) the error-prone java compiler.
28 */
29 public class ChromiumErrorProneCompiler {
30
31 public static void main(String[] args) {
32 System.exit(compile(args));
33 }
34
35 private static int compile(String[] args) {
36 PrintWriter printWriter = new PrintWriter(System.err, true);
37 Main main = new Main("javac (chromium-error-prone)", printWriter);
38 Context context = new Context();
39 JavacFileManager.preRegister(context);
40
41 ErrorProneOptions epOptions = ErrorProneOptions.processArgs(args);
42 final Set<String> disabledChecks = new HashSet<String>(epOptions.getDisa bledChecks());
43
44 Scanner scannerInContext = new ErrorProneScanner(new ErrorProneScanner.E nabledPredicate() {
45 @Override
46 public boolean isEnabled(Class<? extends BugChecker> check, BugPatte rn annotation) {
47 return !disabledChecks.contains(check.getCanonicalName());
48 }
49 });
50 context.put(Scanner.class, scannerInContext);
51
52 ErrorReportingJavaCompiler.preRegister(context);
53 return JDKCompatible.runCompile(
54 main, epOptions.getRemainingArgs(), context, List.<JavaFileObjec t>nil(), null);
55 }
56
57 }
OLDNEW
« no previous file with comments | « third_party/errorprone/errorprone.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698