8350007: Add usage message to the javadoc executable

Reviewed-by: hannesw
This commit is contained in:
Nizar Benalla 2025-03-10 16:15:23 +00:00
parent 32f2c2d808
commit 6b84bdef3b
3 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -555,6 +555,9 @@ public class Start {
if (options.modules().isEmpty()) {
if (options.subpackages().isEmpty()) {
if (javaNames.isEmpty() && isEmpty(fileObjects)) {
showLinesUsingKey("main.usage.short");
showLinesUsingKey("main.for-more-details-see-usage");
log.flush();
String text = log.getText("main.No_modules_packages_or_classes_specified");
throw new ToolException(CMDERR, text);
}

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,9 @@ main.usage=Usage:\n\
\ javadoc [options] [packagenames] [sourcefiles] [@files]\n\
where options include:
main.usage.short=Usage:\n\
\ javadoc [options] [packagenames] [sourcefiles] [@files]
main.did-you-mean=\
Did you mean: {0}

View File

@ -23,12 +23,11 @@
/*
* @test
* @bug 8348038
* @bug 8348038 8350007
* @summary Verify use of "-XDignore.symbol.file=true" doesn't cause assertion failure
* @modules jdk.javadoc/jdk.javadoc.internal.tool
*/
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
@ -42,7 +41,7 @@ public class JavadocIgnoreSymbolFile {
try (PrintWriter pw = new PrintWriter(buf)) {
jdk.javadoc.internal.tool.Main.execute(javadocArgs, pw);
}
String expected = "error: No modules, packages or classes specified. 1 error";
String expected = "Usage: javadoc [options] [packagenames] [sourcefiles] [@files] For more details on available options, use --help or --help-extra error: No modules, packages or classes specified. 1 error";
String actual = buf.toString().trim().replaceAll("\\s+", " ");
if (!actual.equals(expected))
throw new AssertionError("unexpected output:\n" + actual);