desruisseaux commented on code in PR #1027:
URL:
https://github.com/apache/maven-compiler-plugin/pull/1027#discussion_r3847318786
##########
src/main/java/org/apache/maven/plugin/compiler/DiagnosticLogger.java:
##########
@@ -118,63 +134,67 @@ public void report(Diagnostic<? extends JavaFileObject>
diagnostic) {
if (message == null || message.isBlank()) {
return;
}
- MessageBuilder record = messageBuilderFactory.builder();
- record.a(message);
- JavaFileObject source = diagnostic.getSource();
- Diagnostic.Kind kind = diagnostic.getKind();
- String style;
- switch (kind) {
- case ERROR:
- style = ".error:-bold,f:red";
- break;
- case MANDATORY_WARNING:
- case WARNING:
- style = ".warning:-bold,f:yellow";
- break;
- default:
- style = ".info:-bold,f:blue";
- if (diagnostic.getLineNumber() == Diagnostic.NOPOS) {
- source = null; // Some messages are generic, e.g.
"Recompile with -Xlint:deprecation".
- }
- break;
- }
- if (source != null) {
- record.newline().a(" at ").a(relativize(source.getName()));
- long line = diagnostic.getLineNumber();
- long column = diagnostic.getColumnNumber();
- if (line != Diagnostic.NOPOS || column != Diagnostic.NOPOS) {
- record.style(style).a('[');
- if (line != Diagnostic.NOPOS) {
- record.a(line);
- }
- if (column != Diagnostic.NOPOS) {
- record.a(',').a(column);
- }
- record.a(']').resetStyle();
+ if (logType == MessageLogType.COMPILER || logType ==
MessageLogType.ALL) {
+ MessageBuilder record = messageBuilderFactory.builder();
+ record.a(message);
+ JavaFileObject source = diagnostic.getSource();
+ Diagnostic.Kind kind = diagnostic.getKind();
+ String style;
+ switch (kind) {
+ case ERROR:
+ style = ".error:-bold,f:red";
+ break;
+ case MANDATORY_WARNING:
Review Comment:
When two `case` are next to each other with no code between them, the intend
is considered clear enough that the compiler does not emit any "fallthrough"
warning. This is equivalent to `case MANDATORY_WARNING, WARNING -> (…some
code…)` in the newer syntax.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]