src/share/classes/com/sun/tools/javac/util/Log.java

changeset 700
7b413ac1a720
parent 664
4124840b35fe
child 798
4868a36f6fd8
     1.1 --- a/src/share/classes/com/sun/tools/javac/util/Log.java	Wed Sep 29 23:27:57 2010 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/util/Log.java	Thu Sep 30 10:47:12 2010 -0700
     1.3 @@ -35,11 +35,14 @@
     1.4  import javax.tools.DiagnosticListener;
     1.5  import javax.tools.JavaFileObject;
     1.6  
     1.7 +import com.sun.tools.javac.api.DiagnosticFormatter;
     1.8 +import com.sun.tools.javac.main.OptionName;
     1.9  import com.sun.tools.javac.tree.JCTree;
    1.10 -import com.sun.tools.javac.api.DiagnosticFormatter;
    1.11  import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
    1.12  import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
    1.13  
    1.14 +import static com.sun.tools.javac.main.OptionName.*;
    1.15 +
    1.16  /** A class for error logs. Reports errors and warnings, and
    1.17   *  keeps track of error numbers and positions.
    1.18   *
    1.19 @@ -129,14 +132,14 @@
    1.20          this.noticeWriter = noticeWriter;
    1.21  
    1.22          Options options = Options.instance(context);
    1.23 -        this.dumpOnError = options.get("-doe") != null;
    1.24 -        this.promptOnError = options.get("-prompt") != null;
    1.25 -        this.emitWarnings = options.get("-Xlint:none") == null;
    1.26 -        this.suppressNotes = options.get("suppressNotes") != null;
    1.27 -        this.MaxErrors = getIntOption(options, "-Xmaxerrs", getDefaultMaxErrors());
    1.28 -        this.MaxWarnings = getIntOption(options, "-Xmaxwarns", getDefaultMaxWarnings());
    1.29 +        this.dumpOnError = options.isSet(DOE);
    1.30 +        this.promptOnError = options.isSet(PROMPT);
    1.31 +        this.emitWarnings = options.isUnset(XLINT_CUSTOM, "none");
    1.32 +        this.suppressNotes = options.isSet("suppressNotes");
    1.33 +        this.MaxErrors = getIntOption(options, XMAXERRS, getDefaultMaxErrors());
    1.34 +        this.MaxWarnings = getIntOption(options, XMAXWARNS, getDefaultMaxWarnings());
    1.35  
    1.36 -        boolean rawDiagnostics = options.get("rawDiagnostics") != null;
    1.37 +        boolean rawDiagnostics = options.isSet("rawDiagnostics");
    1.38          messages = JavacMessages.instance(context);
    1.39          this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(options) :
    1.40                                                new BasicDiagnosticFormatter(options, messages);
    1.41 @@ -150,7 +153,7 @@
    1.42              expectDiagKeys = new HashSet<String>(Arrays.asList(ek.split(", *")));
    1.43      }
    1.44      // where
    1.45 -        private int getIntOption(Options options, String optionName, int defaultValue) {
    1.46 +        private int getIntOption(Options options, OptionName optionName, int defaultValue) {
    1.47              String s = options.get(optionName);
    1.48              try {
    1.49                  if (s != null) {

mercurial