equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2014, 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. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
27 |
27 |
28 import java.io.File; |
28 import java.io.File; |
29 import java.io.IOException; |
29 import java.io.IOException; |
30 import java.io.PrintWriter; |
30 import java.io.PrintWriter; |
31 import java.util.ArrayList; |
31 import java.util.ArrayList; |
32 import java.util.HashSet; |
|
33 import java.util.LinkedList; |
32 import java.util.LinkedList; |
34 import java.util.List; |
33 import java.util.List; |
35 import java.util.Queue; |
34 import java.util.Queue; |
36 import java.util.Set; |
|
37 |
35 |
38 import javax.lang.model.element.Name; |
36 import javax.lang.model.element.Name; |
39 import javax.tools.JavaFileObject; |
|
40 import javax.tools.StandardLocation; |
37 import javax.tools.StandardLocation; |
41 |
38 |
42 import com.sun.source.doctree.DocCommentTree; |
39 import com.sun.source.doctree.DocCommentTree; |
43 import com.sun.source.tree.ClassTree; |
40 import com.sun.source.tree.ClassTree; |
44 import com.sun.source.tree.CompilationUnitTree; |
41 import com.sun.source.tree.CompilationUnitTree; |
112 final Object[] args; |
109 final Object[] args; |
113 } |
110 } |
114 |
111 |
115 /** |
112 /** |
116 * Simple API entry point. |
113 * Simple API entry point. |
|
114 * @param args Options and operands for doclint |
|
115 * @throws BadArgs if an error is detected in any args |
|
116 * @throws IOException if there are problems with any of the file arguments |
117 */ |
117 */ |
118 public void run(String... args) throws BadArgs, IOException { |
118 public void run(String... args) throws BadArgs, IOException { |
119 PrintWriter out = new PrintWriter(System.out); |
119 PrintWriter out = new PrintWriter(System.out); |
120 try { |
120 try { |
121 run(out, args); |
121 run(out, args); |
126 |
126 |
127 public void run(PrintWriter out, String... args) throws BadArgs, IOException { |
127 public void run(PrintWriter out, String... args) throws BadArgs, IOException { |
128 env = new Env(); |
128 env = new Env(); |
129 processArgs(args); |
129 processArgs(args); |
130 |
130 |
131 if (needHelp) |
131 boolean noFiles = javacFiles.isEmpty(); |
|
132 if (needHelp) { |
132 showHelp(out); |
133 showHelp(out); |
133 |
134 if (noFiles) |
134 if (javacFiles.isEmpty()) { |
135 return; |
135 if (!needHelp) |
136 } else if (noFiles) { |
136 out.println(localize("dc.main.no.files.given")); |
137 out.println(localize("dc.main.no.files.given")); |
|
138 return; |
137 } |
139 } |
138 |
140 |
139 JavacTool tool = JavacTool.create(); |
141 JavacTool tool = JavacTool.create(); |
140 |
142 |
141 JavacFileManager fm = new JavacFileManager(new Context(), false, null); |
143 JavacFileManager fm = new JavacFileManager(new Context(), false, null); |