Esempio n. 1
0
  /**
   * @param args .
   *     <p>This class uses the annotationType() method of class DocAnnotation, so if there is an
   *     annotation in the source with its class not in the class path, a ClassCastException will be
   *     thrown. <br>
   *     For example, in order to use the PreAuthorize annotation, the spring-security-core JAR
   *     needs to be added to the class path. <br>
   *     <a
   *     href="http://stackoverflow.com/questions/5314738/javadoc-annotations-from-third-party-libraries">
   *     related question in stackoverflow</a>
   */
  public static void main(final String[] args) {

    /**
     * This class uses the annotationType() method of class DocAnnotation, so if there is an
     * annotation in the source which its class is not in the class path, a ClassCastException will
     * be thrown. For example, to use the PreAuthorize annotation, the spring-security-core JAR need
     * to be added to the class path. See <a
     * href="http://stackoverflow.com/questions/5314738/javadoc-annotations-from-third-party-libraries">
     * related question in stackoverflow</a>
     */
    com.sun.tools.javadoc.Main.execute(
        new String[] {
          RestDocConstants.DOCLET_FLAG,
          RestDoclet.class.getName(),
          RestDocConstants.SOURCE_PATH_FLAG,
          RestDocConstants.SOURCES_PATH,
          RestDocConstants.CONTROLLERS_PACKAGE,
          RestDocConstants.VELOCITY_TEMPLATE_PATH_FLAG,
          RestDocConstants.VELOCITY_TEMPLATE_PATH,
          RestDocConstants.DOC_DEST_PATH_FLAG,
          RestDocConstants.DOC_DEST_PATH,
          RestDocConstants.DOC_CSS_PATH_FLAG,
          RestDocConstants.DOC_CSS_PATH,
          RestDocConstants.VERSION_FLAG,
          RestDocConstants.VERSION
        });
  }
Esempio n. 2
0
  void run() throws Exception {
    File classesDir = new File("classes");
    classesDir.mkdirs();
    writeFile(baseFile, baseText);
    String[] javacArgs = {"-d", classesDir.getPath(), baseFile.getPath()};
    com.sun.tools.javac.Main.compile(javacArgs);

    writeFile(srcFile, srcText);
    String[] args = {
      "-d", "api", "-classpath", classesDir.getPath(), "-package", "p", srcFile.getPath()
    };

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    PrintStream prev = System.err;
    System.setErr(ps);
    try {
      int rc = com.sun.tools.javadoc.Main.execute(args);
    } finally {
      System.err.flush();
      System.setErr(prev);
    }
    String out = baos.toString();
    System.out.println(out);

    String errorMessage = "java.lang.IllegalArgumentException: <clinit>";
    if (out.contains(errorMessage)) throw new Exception("error message found: " + errorMessage);
  }
 public static void main(String[] args) {
   // run javadoc on package pkg
   if (com.sun.tools.javadoc.Main.execute(
           "javadoc",
           "CompletionFailure",
           CompletionFailure.class.getClassLoader(),
           new String[] {"pkg"})
       != 0) throw new Error();
 }
  public static void main(String[] args) {
    String thisFile =
        "" + new java.io.File(System.getProperty("test.src", "."), "BreakIteratorWarning.java");

    if (com.sun.tools.javadoc.Main.execute(
            "javadoc",
            "BreakIteratorWarning",
            BreakIteratorWarning.class.getClassLoader(),
            new String[] {"-Xwerror", thisFile})
        != 0) throw new Error("Javadoc encountered warnings or errors.");
  }
  public static ApiDocs scan(String... files) {
    try {
      result = new ApiDocs();
      LinkedHashSet<String> sources = new LinkedHashSet<String>();
      for (String file : files) findSourceFiles(sources, file);

      Main.execute(
          "borqs_server_api_doc_scanner",
          HttpApiDoclet.class.getName(),
          sources.toArray(new String[sources.size()]));
      return result;
    } finally {
      result = null;
    }
  }
Esempio n. 6
0
 /** Run javadoc */
 public static void runJavadoc(String[] javadocArgs) {
   if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
     throw new Error("Javadoc failed to execute");
   }
 }
Esempio n. 7
0
 public static void main(String[] args) {
   com.sun.tools.javadoc.Main.execute(args);
 }
Esempio n. 8
0
 public static void main(String args[]) {
   PrintWriter err = new PrintWriter(System.err);
   com.sun.tools.javadoc.Main.execute(programName, err, err, err, docletName, args);
 }