Skip to content
Permalink
Browse files
8246705: javadoc gives "misleading" and incomplete warning message
Reviewed-by: hannesw
  • Loading branch information
jonathan-gibbons committed Jun 10, 2020
1 parent 56abdc1 commit 0652a7883d823ab77753dbabb86e0af161a4ae89
Showing 4 changed files with 17 additions and 11 deletions.
@@ -566,7 +566,10 @@ private Set<ModuleElement> getModuleRequires(ModuleElement mdle, boolean onlyTra
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 @@ private boolean isMandated(ModuleElement mdle, RequiresDirective rd) {
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 @@ private void computeSpecifiedModules() throws ToolException {

if (expandAll) {
// add non-public requires if needed
result.addAll(getModuleRequires(mdle, !expandAll));
result.addAll(getModuleRequires(mdle, false));
}
}

@@ -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}
@@ -23,7 +23,7 @@

/*
* @test
* @bug 8176481
* @bug 8176481 8246705
* @summary Tests behavior of the tool, when modules are present as
* binaries.
* @modules
@@ -60,7 +60,7 @@ public void testExplicitBinaryModuleOnModulePath(Path base) throws Exception {

execNegativeTask("--module-path", modulePath.toString(),
"--module", "ma");
assertMessagePresent("module ma not found.");
assertMessagePresent("module ma not found");
}

@Test
@@ -77,11 +77,11 @@ public void testExplicitBinaryModuleOnLegacyPaths(Path base) throws Exception {
Path mPath = Paths.get(modulePath.toString(), "ma");
execNegativeTask("--source-path", mPath.toString(),
"--module", "ma");
assertMessagePresent("module ma not found.");
assertMessagePresent("module ma not found on source path");

execNegativeTask("--class-path", mPath.toString(),
"--module", "ma");
assertMessagePresent("module ma not found.");
assertMessagePresent("module ma not found");
}

@Test
@@ -106,7 +106,7 @@ public void testImplicitBinaryRequiresModule(Path base) throws Exception {
"--module-source-path", src.toString(),
"--expand-requires", "all",
"--module", "ma");
assertMessagePresent("module mb not found.");
assertMessagePresent("source files for module mb not found");
}

@Test
@@ -131,6 +131,6 @@ public void testImplicitBinaryTransitiveModule(Path base) throws Exception {
"--module-source-path", src.toString(),
"--expand-requires", "transitive",
"--module", "ma");
assertMessagePresent("module mb not found.");
assertMessagePresent("source files for module mb not found");
}
}
@@ -534,7 +534,7 @@ public void testMissingModule(Path base) throws Exception {
"--module", "MIA",
"--expand-requires", "all");

assertMessagePresent("javadoc: error - module MIA not found.");
assertMessagePresent("javadoc: error - module MIA not found");
}

@Test

0 comments on commit 0652a78

Please sign in to comment.