author | katleman |
Tue, 21 Jan 2014 18:17:23 -0800 | |
changeset 22365 | 895bfde469d4 |
parent 15354 | 52a04c670c05 |
child 23139 | 612191246a7d |
permissions | -rw-r--r-- |
8633
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
1 |
/* |
15354 | 2 |
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
8633
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
4 |
* |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
8 |
* |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
13 |
* accompanied this code). |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
14 |
* |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
18 |
* |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
21 |
* questions. |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
22 |
*/ |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
23 |
|
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
24 |
/* |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
25 |
* @test |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
26 |
* @bug 6964914 |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
27 |
* @summary javadoc does not output number of warnings using user written doclet |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
28 |
*/ |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
29 |
|
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
30 |
import java.io.*; |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
31 |
|
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
32 |
public class Test { |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
33 |
public static void main(String... args) throws Exception { |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
34 |
new Test().run(); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
35 |
} |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
36 |
|
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
37 |
public void run() throws Exception { |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
38 |
javadoc("Error.java", "1 error"); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
39 |
javadoc("JavacWarning.java", "1 warning"); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
40 |
javadoc("JavadocWarning.java", "1 warning"); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
41 |
if (errors > 0) |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
42 |
throw new Exception(errors + " errors found"); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
43 |
} |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
44 |
|
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
45 |
void javadoc(String path, String expect) { |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
46 |
File testSrc = new File(System.getProperty("test.src")); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
47 |
String[] args = { |
15354 | 48 |
"-Xdoclint:none", |
8633
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
49 |
"-source", "1.4", // enables certain Parser warnings |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
50 |
"-bootclasspath", System.getProperty("sun.boot.class.path"), |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
51 |
"-classpath", ".", |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
52 |
"-package", |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
53 |
new File(testSrc, path).getPath() |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
54 |
}; |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
55 |
|
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
56 |
StringWriter sw = new StringWriter(); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
57 |
PrintWriter pw = new PrintWriter(sw); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
58 |
int rc = com.sun.tools.javadoc.Main.execute( |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
59 |
"javadoc", |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
60 |
pw, pw, pw, |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
61 |
com.sun.tools.doclets.standard.Standard.class.getName(), |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
62 |
args); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
63 |
pw.close(); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
64 |
String out = sw.toString(); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
65 |
if (!out.isEmpty()) |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
66 |
System.err.println(out); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
67 |
System.err.println("javadoc exit: rc=" + rc); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
68 |
|
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
69 |
if (!out.contains(expect)) |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
70 |
error("expected text not found: " + expect); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
71 |
} |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
72 |
|
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
73 |
void error(String msg) { |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
74 |
System.err.println("Error: " + msg); |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
75 |
errors++; |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
76 |
} |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
77 |
|
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
78 |
int errors; |
41311e88ffb7
6964914: javadoc does not output number of warnings using user written doclet
jjg
parents:
diff
changeset
|
79 |
} |