< prev index next >

langtools/test/tools/javadoc/6964914/TestStdDoclet.java

Print this page




  30 import java.io.*;
  31 import java.util.*;
  32 
  33 /**
  34  * Dummy javadoc comment.
  35  * @author jjg
  36  * @see DoesNotExist
  37  */
  38 public class TestStdDoclet {
  39     public static void main(String... args) throws Exception {
  40         new TestStdDoclet().run();
  41     }
  42 
  43     /**
  44      * More dummy comments.
  45      * @throws DoesNotExist   oops, javadoc does not see this
  46      * @see DoesNotExist
  47      */
  48     void run() throws Exception {
  49         File javaHome = new File(System.getProperty("java.home"));
  50         if (javaHome.getName().equals("jre"))
  51             javaHome = javaHome.getParentFile();
  52         File javadoc = new File(new File(javaHome, "bin"), "javadoc");
  53         File testSrc = new File(System.getProperty("test.src"));
  54 
  55         // run javadoc in separate process to ensure doclet executed under
  56         // normal user conditions w.r.t. classloader
  57         String thisClassName = TestStdDoclet.class.getName();
  58         List<String> cmdArgs = new ArrayList<>();
  59         cmdArgs.add(javadoc.getPath());
  60         int i = 0;
  61         String prop;
  62         while ((prop = System.getProperty("jdk.launcher.patch." + (i++))) != null) {
  63             cmdArgs.add("-J-Xpatch:" + prop);
  64         }
  65         cmdArgs.addAll(Arrays.asList(
  66                 "-classpath", ".", // insulates us from ambient classpath
  67                 "-Xdoclint:none",
  68                 "-package",
  69                 new File(testSrc, thisClassName + ".java").getPath()
  70         ));
  71         Process p = new ProcessBuilder()
  72             .command(cmdArgs)
  73             .redirectErrorStream(true)
  74             .start();
  75 
  76         int actualDocletWarnCount = 0;
  77         int reportedDocletWarnCount = 0;
  78         BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
  79         try {
  80             String line;
  81             while ((line = in.readLine()) != null) {
  82                 System.err.println(line);
  83                 if (line.contains("DoesNotExist"))
  84                     actualDocletWarnCount++;




  30 import java.io.*;
  31 import java.util.*;
  32 
  33 /**
  34  * Dummy javadoc comment.
  35  * @author jjg
  36  * @see DoesNotExist
  37  */
  38 public class TestStdDoclet {
  39     public static void main(String... args) throws Exception {
  40         new TestStdDoclet().run();
  41     }
  42 
  43     /**
  44      * More dummy comments.
  45      * @throws DoesNotExist   oops, javadoc does not see this
  46      * @see DoesNotExist
  47      */
  48     void run() throws Exception {
  49         File javaHome = new File(System.getProperty("java.home"));


  50         File javadoc = new File(new File(javaHome, "bin"), "javadoc");
  51         File testSrc = new File(System.getProperty("test.src"));
  52 
  53         // run javadoc in separate process to ensure doclet executed under
  54         // normal user conditions w.r.t. classloader
  55         String thisClassName = TestStdDoclet.class.getName();
  56         List<String> cmdArgs = new ArrayList<>();
  57         cmdArgs.add(javadoc.getPath());





  58         cmdArgs.addAll(Arrays.asList(
  59                 "-classpath", ".", // insulates us from ambient classpath
  60                 "-Xdoclint:none",
  61                 "-package",
  62                 new File(testSrc, thisClassName + ".java").getPath()
  63         ));
  64         Process p = new ProcessBuilder()
  65             .command(cmdArgs)
  66             .redirectErrorStream(true)
  67             .start();
  68 
  69         int actualDocletWarnCount = 0;
  70         int reportedDocletWarnCount = 0;
  71         BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
  72         try {
  73             String line;
  74             while ((line = in.readLine()) != null) {
  75                 System.err.println(line);
  76                 if (line.contains("DoesNotExist"))
  77                     actualDocletWarnCount++;


< prev index next >