mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8200363: Add javadoc command line setting to fail on warnings
Reviewed-by: hannesw
This commit is contained in:
parent
85f5e328ed
commit
ee9483bd87
4 changed files with 129 additions and 12 deletions
|
@ -436,13 +436,15 @@ public class Start {
|
|||
fileManager.close();
|
||||
} catch (IOException ignore) {}
|
||||
}
|
||||
boolean haveErrorWarnings = messager.hasErrors()
|
||||
|| (this.options.rejectWarnings() && messager.hasWarnings());
|
||||
if (!result.isOK() && !haveErrorWarnings) {
|
||||
if (this.options.rejectWarnings() && messager.hasWarnings()) {
|
||||
error("main.warnings.Werror");
|
||||
}
|
||||
boolean haveErrors = messager.hasErrors();
|
||||
if (!result.isOK() && !haveErrors) {
|
||||
// the doclet failed, but nothing reported, flag it!.
|
||||
error("main.unknown.error");
|
||||
}
|
||||
if (haveErrorWarnings && result.isOK()) {
|
||||
if (haveErrors && result.isOK()) {
|
||||
result = ERROR;
|
||||
}
|
||||
messager.printErrorWarningCounts();
|
||||
|
|
|
@ -107,8 +107,8 @@ public class ToolOptions {
|
|||
private List<String> modules = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -Xwerror}.
|
||||
* Set by -Xwerror.
|
||||
* Argument for command-line option {@code -Werror}.
|
||||
* Set by -Werror.
|
||||
*/
|
||||
private boolean rejectWarnings = false;
|
||||
|
||||
|
@ -514,6 +514,9 @@ public class ToolOptions {
|
|||
}
|
||||
},
|
||||
|
||||
// superseded by -Werror, retained for a while for compatibility,
|
||||
// although note that it is an undocumented hidden option, and can
|
||||
// be removed without warning
|
||||
new ToolOption("-Xwerror", HIDDEN) {
|
||||
@Override
|
||||
public void process() {
|
||||
|
@ -521,6 +524,13 @@ public class ToolOptions {
|
|||
}
|
||||
},
|
||||
|
||||
new ToolOption("-Werror", STANDARD) {
|
||||
@Override
|
||||
public void process() {
|
||||
rejectWarnings = true;
|
||||
}
|
||||
},
|
||||
|
||||
// ----- other options -----
|
||||
|
||||
new ToolOption("-breakiterator", STANDARD) {
|
||||
|
@ -731,8 +741,8 @@ public class ToolOptions {
|
|||
}
|
||||
|
||||
/**
|
||||
* Argument for command-line option {@code -Xwerror}.
|
||||
* Set by -Xwerror.
|
||||
* Argument for command-line option {@code -Werror}.
|
||||
* Set by -Werror.
|
||||
*/
|
||||
boolean rejectWarnings() {
|
||||
return rejectWarnings;
|
||||
|
|
|
@ -215,6 +215,9 @@ main.opt.J.desc=\
|
|||
main.opt.help.extra.desc=\
|
||||
Print a synopsis of nonstandard options and exit
|
||||
|
||||
main.opt.Werror.desc=\
|
||||
Report an error if any warnings occur
|
||||
|
||||
main.usage.foot=\n\
|
||||
GNU-style options may use '=' instead of whitespace to separate the name of an\n\
|
||||
option from its value.\n
|
||||
|
@ -251,9 +254,6 @@ main.opt.patch.module.desc=\
|
|||
Override or augment a module with classes and resources in\n\
|
||||
JAR files or directories
|
||||
|
||||
main.opt.Xold.desc=\
|
||||
Invoke the legacy javadoc tool
|
||||
|
||||
main.Xusage.foot=\n\
|
||||
These options are non-standard and subject to change without notice.
|
||||
|
||||
|
@ -291,7 +291,8 @@ main.illegal_class_name=Illegal class name: "{0}"
|
|||
main.illegal_package_name=Illegal package name: "{0}"
|
||||
main.illegal_option_value=Illegal option value: "{0}"
|
||||
main.file.manager.list=FileManager error listing files: "{0}"
|
||||
main.assertion.error=assertion failed: "{0}}"
|
||||
main.assertion.error=assertion failed: "{0}"
|
||||
main.warnings.Werror=warnings found and -Werror specified
|
||||
main.unknown.error=an unknown error has occurred
|
||||
main.internal.error=an internal error has occurred
|
||||
main.unexpected.exception=an unexpected exception was caught: {0}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue