Skip to content

Commit c4942d0

Browse files
author
duke
committedMay 19, 2020
Automatic merge of jdk:master into master
2 parents 8810056 + 554e988 commit c4942d0

File tree

4 files changed

+81
-1
lines changed

4 files changed

+81
-1
lines changed
 

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,10 @@ private void showToolOption(ToolOption option) {
240240
String primaryName = option.primaryName;
241241
String parameters;
242242
if (option.hasArg || primaryName.endsWith(":")) {
243-
String sep = primaryName.equals(ToolOptions.J) || primaryName.endsWith(":") ? "" : " ";
243+
String sep = primaryName.endsWith(":")
244+
|| primaryName.equals(ToolOptions.AT)
245+
|| primaryName.equals(ToolOptions.J)
246+
? "" : " ";
244247
parameters = sep + option.getParameters(messager);
245248
} else {
246249
parameters = "";

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOptions.java

+13
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public class ToolOptions {
6666
static final String DOCLET = "-doclet";
6767
static final String DOCLET_PATH = "-docletpath";
6868
static final String DUMP_ON_ERROR = "--dump-on-error";
69+
static final String AT = "@";
6970
static final String J = "-J";
7071
static final String LOCALE = "-locale";
7172

@@ -587,6 +588,17 @@ public void process() {
587588
}
588589
},
589590

591+
// This option exists so that it is documented in the command-line help.
592+
// It is actually implemented by expanding argv early on during execution,
593+
// and can only be used when using the command-line and related interfaces
594+
// (i.e. not the javax.tools API).
595+
new ToolOption(AT, STANDARD, true) {
596+
@Override
597+
public void process() {
598+
throw new AssertionError("the @ option is handled separately");
599+
}
600+
},
601+
590602
new ToolOption("--version", STANDARD) {
591603
@Override
592604
public void process() throws OptionException {
@@ -648,6 +660,7 @@ private String getKey(String optionName, String suffix) {
648660
return "main.opt."
649661
+ optionName
650662
.replaceAll("^-*", "") // remove leading '-'
663+
.replaceAll("^@", "at") // handle '@'
651664
.replaceAll("[^A-Za-z0-9]+$", "") // remove trailing non-alphanumeric
652665
.replaceAll("[^A-Za-z0-9]", ".") // replace internal non-alphanumeric
653666
+ suffix;

‎src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ main.usage=Usage:\n\
3232
\ javadoc [options] [packagenames] [sourcefiles] [@files]\n\
3333
where options include:
3434

35+
main.opt.at.arg=\
36+
<file>
37+
main.opt.at.desc=\
38+
Read options and filenames from file
39+
3540
main.opt.public.desc=\
3641
Show only public types and members. For named modules,\n\
3742
show exported packages and the module''s API.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* @test
26+
* @bug 8243396
27+
* @summary general tests for command-line help
28+
* @library ../lib
29+
* @modules jdk.javadoc/jdk.javadoc.internal.tool
30+
* @build javadoc.tester.*
31+
* @run main CommandLineHelpTest
32+
*/
33+
34+
import java.nio.file.Path;
35+
36+
import javadoc.tester.JavadocTester;
37+
38+
public class CommandLineHelpTest extends JavadocTester {
39+
public static void main(String... args) throws Exception {
40+
CommandLineHelpTest tester = new CommandLineHelpTest();
41+
tester.runTests(m -> new Object[] { Path.of(m.getName()) });
42+
}
43+
44+
@Test
45+
public void testStandard(Path base) {
46+
javadoc("-d", base.resolve("out").toString(),
47+
"--help");
48+
checkExit(Exit.OK);
49+
50+
// check no resources missing
51+
checkOutput(Output.OUT, false,
52+
"message file broken");
53+
54+
checkOutput(Output.OUT, true,
55+
"@<file>",
56+
"-J<flag>");
57+
}
58+
59+
}

0 commit comments

Comments
 (0)
Please sign in to comment.