1 /* |
1 /* |
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2016, 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. |
27 * @summary javadoc does not output number of warnings using user written doclet |
27 * @summary javadoc does not output number of warnings using user written doclet |
28 * @modules jdk.javadoc |
28 * @modules jdk.javadoc |
29 */ |
29 */ |
30 |
30 |
31 import java.io.*; |
31 import java.io.*; |
|
32 import java.util.*; |
|
33 |
32 import com.sun.javadoc.Doclet; |
34 import com.sun.javadoc.Doclet; |
33 import com.sun.javadoc.RootDoc; |
35 import com.sun.javadoc.RootDoc; |
34 |
36 |
35 public class TestUserDoclet extends Doclet { |
37 public class TestUserDoclet extends Doclet { |
36 public static void main(String... args) throws Exception { |
38 public static void main(String... args) throws Exception { |
53 File testClasses = new File(System.getProperty("test.classes")); |
55 File testClasses = new File(System.getProperty("test.classes")); |
54 |
56 |
55 // run javadoc in separate process to ensure doclet executed under |
57 // run javadoc in separate process to ensure doclet executed under |
56 // normal user conditions w.r.t. classloader |
58 // normal user conditions w.r.t. classloader |
57 String thisClassName = TestUserDoclet.class.getName(); |
59 String thisClassName = TestUserDoclet.class.getName(); |
58 Process p = new ProcessBuilder() |
60 List<String> cmdArgs = new ArrayList<>(); |
59 .command(javadoc.getPath(), |
61 cmdArgs.add(javadoc.getPath()); |
60 "-J-Xpatch:" + System.getProperty("jdk.launcher.patch.0", ""), |
62 int i = 0; |
|
63 String prop; |
|
64 while ((prop = System.getProperty("jdk.launcher.patch." + (i++))) != null) { |
|
65 cmdArgs.add("-J-Xpatch:" + prop); |
|
66 } |
|
67 cmdArgs.addAll(Arrays.asList( |
61 "-doclet", thisClassName, |
68 "-doclet", thisClassName, |
62 "-docletpath", testClasses.getPath(), |
69 "-docletpath", testClasses.getPath(), |
63 new File(testSrc, thisClassName + ".java").getPath()) |
70 new File(testSrc, thisClassName + ".java").getPath() |
|
71 )); |
|
72 Process p = new ProcessBuilder() |
|
73 .command(cmdArgs) |
64 .redirectErrorStream(true) |
74 .redirectErrorStream(true) |
65 .start(); |
75 .start(); |
66 |
76 |
67 int actualDocletWarnCount = 0; |
77 int actualDocletWarnCount = 0; |
68 int reportedDocletWarnCount = 0; |
78 int reportedDocletWarnCount = 0; |