123 Options options = Options.instance(context); |
123 Options options = Options.instance(context); |
124 this.dumpOnError = options.get("-doe") != null; |
124 this.dumpOnError = options.get("-doe") != null; |
125 this.promptOnError = options.get("-prompt") != null; |
125 this.promptOnError = options.get("-prompt") != null; |
126 this.emitWarnings = options.get("-Xlint:none") == null; |
126 this.emitWarnings = options.get("-Xlint:none") == null; |
127 this.suppressNotes = options.get("suppressNotes") != null; |
127 this.suppressNotes = options.get("suppressNotes") != null; |
128 this.MaxErrors = getIntOption(options, "-Xmaxerrs", 100); |
128 this.MaxErrors = getIntOption(options, "-Xmaxerrs", getDefaultMaxErrors()); |
129 this.MaxWarnings = getIntOption(options, "-Xmaxwarns", 100); |
129 this.MaxWarnings = getIntOption(options, "-Xmaxwarns", getDefaultMaxWarnings()); |
130 |
130 |
131 boolean rawDiagnostics = options.get("rawDiagnostics") != null; |
131 boolean rawDiagnostics = options.get("rawDiagnostics") != null; |
132 messages = JavacMessages.instance(context); |
132 messages = JavacMessages.instance(context); |
133 this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(options) : |
133 this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(options) : |
134 new BasicDiagnosticFormatter(options, messages); |
134 new BasicDiagnosticFormatter(options, messages); |
151 } |
151 } |
152 } catch (NumberFormatException e) { |
152 } catch (NumberFormatException e) { |
153 // silently ignore ill-formed numbers |
153 // silently ignore ill-formed numbers |
154 } |
154 } |
155 return defaultValue; |
155 return defaultValue; |
|
156 } |
|
157 |
|
158 /** Default value for -Xmaxerrs. |
|
159 */ |
|
160 protected int getDefaultMaxErrors() { |
|
161 return 100; |
|
162 } |
|
163 |
|
164 /** Default value for -Xmaxwarns. |
|
165 */ |
|
166 protected int getDefaultMaxWarnings() { |
|
167 return 100; |
156 } |
168 } |
157 |
169 |
158 /** The default writer for diagnostics |
170 /** The default writer for diagnostics |
159 */ |
171 */ |
160 static final PrintWriter defaultWriter(Context context) { |
172 static final PrintWriter defaultWriter(Context context) { |