8246705: javadoc gives "misleading" and incomplete warning message

Reviewed-by: hannesw
This commit is contained in:
Jonathan Gibbons 2020-06-09 19:50:30 -07:00
parent 56abdc178e
commit 0652a7883d
4 changed files with 17 additions and 11 deletions

View file

@ -566,7 +566,10 @@ public class ElementsTable {
continue;
if (!isMandated(mdle, rd) && onlyTransitive == rd.isTransitive()) {
if (!haveModuleSources(dep)) {
messager.printWarning(dep, "main.module_not_found", dep.getSimpleName());
if (!warnedNoSources.contains(dep)) {
messager.printWarning(dep, "main.module_source_not_found", dep.getQualifiedName());
warnedNoSources.add(dep);
}
}
result.add(dep);
} else if (isMandated(mdle, rd) && haveModuleSources(dep)) {
@ -580,9 +583,11 @@ public class ElementsTable {
return toolEnv.elements.getOrigin(mdle, rd) == MANDATED;
}
Set<ModuleElement> warnedNoSources = new HashSet<>();
Map<ModuleSymbol, Boolean> haveModuleSourcesCache = new HashMap<>();
private boolean haveModuleSources(ModuleElement mdle) throws ToolException {
ModuleSymbol msym = (ModuleSymbol)mdle;
ModuleSymbol msym = (ModuleSymbol) mdle;
if (msym.sourceLocation != null) {
return true;
}
@ -620,7 +625,7 @@ public class ElementsTable {
if (expandAll) {
// add non-public requires if needed
result.addAll(getModuleRequires(mdle, !expandAll));
result.addAll(getModuleRequires(mdle, false));
}
}

View file

@ -269,7 +269,8 @@ main.unnecessary_arg_provided=option {0} does not require an argument
main.only_one_argument_with_equals=cannot use ''='' syntax for options that require multiple arguments
main.invalid_flag=invalid flag: {0}
main.No_modules_packages_or_classes_specified=No modules, packages or classes specified.
main.module_not_found=module {0} not found.\n
main.module_not_found=module {0} not found
main.module_source_not_found=source files for module {0} not found
main.cannot_use_sourcepath_for_modules=cannot use source path for multiple modules {0}
main.module_not_found_on_sourcepath=module {0} not found on source path
main.sourcepath_does_not_contain_module=source path does not contain module {0}