test/tools/javadoc/6964914/Test.java

Mon, 21 Jan 2013 20:13:56 +0000

author
mcimadamore
date
Mon, 21 Jan 2013 20:13:56 +0000
changeset 1510
7873d37f5b37
parent 1490
fc4cb1577ad6
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8005244: Implement overload resolution as per latest spec EDR
Summary: Add support for stuck expressions and provisional applicability
Reviewed-by: jjg

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

mercurial