Skip to content

Commit

Permalink
Report Javadoc problems as warnings for most severe
Browse files Browse the repository at this point in the history
Errors from javadoc look out of place for now.
Maybe in the future if/when there are settings for each of them they can
be switched back to errors depending on settings.
  • Loading branch information
akurtakov authored and mickaelistria committed May 21, 2024
1 parent 3da323d commit af54a63
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static JavacProblem createJavadocProblem(Diagnostic<? extends JavaFileObj
diagnostic.getCode(),
problemId,
new String[0],
toSeverity(diagnostic),
toJavadocSeverity(diagnostic),
diagnosticPosition.getOffset(),
diagnosticPosition.getOffset() + diagnosticPosition.getLength(),
(int) diagnostic.getLineNumber(),
Expand Down Expand Up @@ -198,6 +198,14 @@ private static int toSeverity(Diagnostic<? extends JavaFileObject> diagnostic) {
default -> ProblemSeverities.Error;
};
}

private static int toJavadocSeverity(Diagnostic<? extends JavaFileObject> diagnostic) {
return switch (diagnostic.getKind()) {
case ERROR, WARNING, MANDATORY_WARNING -> ProblemSeverities.Warning;
case NOTE -> ProblemSeverities.Info;
default -> ProblemSeverities.Warning;
};
}

/**
* See the link below for Javac problem list:
Expand Down

0 comments on commit af54a63

Please sign in to comment.