1 /* |
1 /* |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 8008768 |
26 * @bug 8008768 |
27 * @summary Using {@inheritDoc} in simple tag defined via -tag fails |
27 * @summary Using {@inheritDoc} in simple tag defined via -tag fails |
28 * @author Mike Duigou |
28 * @author Mike Duigou |
|
29 * @library ../lib |
|
30 * @build JavadocTester |
29 * @run main DocTest |
31 * @run main DocTest |
30 */ |
32 */ |
31 |
|
32 import java.io.*; |
|
33 |
33 |
34 /** |
34 /** |
35 * DocTest documentation. |
35 * DocTest documentation. |
36 * |
36 * |
37 * @apiNote DocTest API note. |
37 * @apiNote DocTest API note. |
38 * @implSpec DocTest implementation spec. |
38 * @implSpec DocTest implementation spec. |
39 * @implNote DocTest implementation note. |
39 * @implNote DocTest implementation note. |
40 */ |
40 */ |
41 public class DocTest { |
41 public class DocTest extends JavadocTester { |
42 public static void main(String... args) throws Exception { |
42 public static void main(String... args) throws Exception { |
43 String[] javadoc_args = { |
43 DocTest tester = new DocTest(); |
44 "-verbose", |
44 tester.runTests(); |
45 "-d", "DocTest", |
45 } |
46 "-tag", "apiNote:optcm:<em>API Note</em>", |
46 |
47 "-tag", "implSpec:optcm:<em>Implementation Requirements</em>:", |
47 @Test |
48 "-tag", "implNote:optcm:<em>Implementation Note</em>:", |
48 void test() { |
49 "-package", |
49 javadoc("-verbose", |
50 new File(System.getProperty("test.src"), "DocTest.java").getPath() |
50 "-d", "DocTest", |
51 }; |
51 "-tag", "apiNote:optcm:<em>API Note</em>", |
|
52 "-tag", "implSpec:optcm:<em>Implementation Requirements</em>:", |
|
53 "-tag", "implNote:optcm:<em>Implementation Note</em>:", |
|
54 "-package", |
|
55 testSrc("DocTest.java") |
|
56 ); |
|
57 checkExit(Exit.OK); |
52 |
58 |
53 // javadoc does not report an exit code for an internal exception (!) |
59 // javadoc does not report an exit code for an internal exception (!) |
54 // so monitor stderr for stack dumps. |
60 // so monitor stderr for stack dumps. |
55 PrintStream prevErr = System.err; |
61 checkOutput(Output.STDERR, false, "at com.sun"); |
56 ByteArrayOutputStream err_baos = new ByteArrayOutputStream(); |
|
57 PrintStream err_ps = new PrintStream(err_baos); |
|
58 System.setErr(err_ps); |
|
59 |
|
60 int rc; |
|
61 try { |
|
62 rc = com.sun.tools.javadoc.Main.execute(javadoc_args); |
|
63 } finally { |
|
64 err_ps.close(); |
|
65 System.setErr(prevErr); |
|
66 } |
|
67 |
|
68 String err = err_baos.toString(); |
|
69 System.err.println(err); |
|
70 |
|
71 if (rc != 0) |
|
72 throw new Exception("javadoc exited with rc=" + rc); |
|
73 |
|
74 if (err.contains("at com.sun.")) |
|
75 throw new Exception("javadoc output contains stack trace"); |
|
76 } |
62 } |
77 |
63 |
78 /** |
64 /** |
79 * DocTest() documentation. |
65 * DocTest() documentation. |
80 * |
66 * |