1
+ /*
2
+ * Copyright (c) 2021, 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 8269722
27
+ * @summary NPE in HtmlDocletWriter, reporting errors on inherited tags
28
+ * @library /tools/lib ../../lib
29
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
30
+ * @build toolbox.ToolBox javadoc.tester.*
31
+ * @run main TestInherited
32
+ */
33
+
34
+ import java .nio .file .Path ;
35
+
36
+ import javadoc .tester .JavadocTester ;
37
+ import toolbox .ToolBox ;
38
+
39
+ public class TestInherited extends JavadocTester {
40
+
41
+ public static void main (String ... args ) throws Exception {
42
+ TestInherited tester = new TestInherited ();
43
+ tester .runTests (m -> new Object [] { Path .of (m .getName ())});
44
+ }
45
+
46
+ private final ToolBox tb = new ToolBox ();
47
+
48
+ @ Test
49
+ public void testBadInheritedParam (Path base ) throws Exception {
50
+ Path src = base .resolve ("src" );
51
+ tb .writeJavaFiles (src , """
52
+ public class BadParam {
53
+ public static class Base {
54
+ /**
55
+ * @param i a < b
56
+ */
57
+ public void m(int i) { }
58
+ }
59
+
60
+ public static class Sub extends Base {
61
+ public void m(int i) { }
62
+ }
63
+ }
64
+ """ );
65
+
66
+ javadoc ("-d" , base .resolve ("out" ).toString (),
67
+ "-Xdoclint:-missing" , "-XDdoe" ,
68
+ src .resolve ("BadParam.java" ).toString ());
69
+ checkExit (Exit .OK );
70
+ }
71
+
72
+ @ Test
73
+ public void testBadInheritedReturn (Path base ) throws Exception {
74
+ Path src = base .resolve ("src" );
75
+ tb .writeJavaFiles (src , """
76
+ public class BadReturn {
77
+ public static class Base {
78
+ /**
79
+ * @return a < b
80
+ */
81
+ public int m() { }
82
+ }
83
+
84
+ public static class Sub extends Base {
85
+ public int m() { }
86
+ }
87
+ }
88
+ """ );
89
+
90
+ javadoc ("-d" , base .resolve ("out" ).toString (),
91
+ "-Xdoclint:-missing" ,
92
+ src .resolve ("BadReturn.java" ).toString ());
93
+ checkExit (Exit .OK );
94
+ }
95
+ }
0 commit comments