118 this.MaxErrors = getIntOption(options, "-Xmaxerrs", 100); |
118 this.MaxErrors = getIntOption(options, "-Xmaxerrs", 100); |
119 this.MaxWarnings = getIntOption(options, "-Xmaxwarns", 100); |
119 this.MaxWarnings = getIntOption(options, "-Xmaxwarns", 100); |
120 |
120 |
121 boolean rawDiagnostics = options.get("rawDiagnostics") != null; |
121 boolean rawDiagnostics = options.get("rawDiagnostics") != null; |
122 messages = JavacMessages.instance(context); |
122 messages = JavacMessages.instance(context); |
123 this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(messages) : |
123 this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(options) : |
124 new BasicDiagnosticFormatter(options, messages); |
124 new BasicDiagnosticFormatter(options, messages); |
125 @SuppressWarnings("unchecked") // FIXME |
125 @SuppressWarnings("unchecked") // FIXME |
126 DiagnosticListener<? super JavaFileObject> diagListener = |
126 DiagnosticListener<? super JavaFileObject> diagListener = |
127 context.get(DiagnosticListener.class); |
127 context.get(DiagnosticListener.class); |
128 this.diagListener = diagListener; |
128 this.diagListener = diagListener; |
338 } |
338 } |
339 |
339 |
340 PrintWriter writer = getWriterForDiagnosticType(diag.getType()); |
340 PrintWriter writer = getWriterForDiagnosticType(diag.getType()); |
341 |
341 |
342 printLines(writer, diagFormatter.format(diag, messages.getCurrentLocale())); |
342 printLines(writer, diagFormatter.format(diag, messages.getCurrentLocale())); |
343 if (diagFormatter.displaySource(diag)) { |
|
344 int pos = diag.getIntPosition(); |
|
345 if (pos != Position.NOPOS) { |
|
346 JavaFileObject prev = useSource(diag.getSource()); |
|
347 printErrLine(pos, writer); |
|
348 useSource(prev); |
|
349 } |
|
350 } |
|
351 |
343 |
352 if (promptOnError) { |
344 if (promptOnError) { |
353 switch (diag.getType()) { |
345 switch (diag.getType()) { |
354 case ERROR: |
346 case ERROR: |
355 case WARNING: |
347 case WARNING: |