134 docenv.setEncoding(encoding); |
134 docenv.setEncoding(encoding); |
135 docenv.docClasses = docClasses; |
135 docenv.docClasses = docClasses; |
136 docenv.legacyDoclet = legacyDoclet; |
136 docenv.legacyDoclet = legacyDoclet; |
137 javadocReader.sourceCompleter = docClasses ? null : thisCompleter; |
137 javadocReader.sourceCompleter = docClasses ? null : thisCompleter; |
138 |
138 |
139 ListBuffer<String> names = new ListBuffer<String>(); |
139 ListBuffer<String> names = new ListBuffer<>(); |
140 ListBuffer<JCCompilationUnit> classTrees = new ListBuffer<JCCompilationUnit>(); |
140 ListBuffer<JCCompilationUnit> classTrees = new ListBuffer<>(); |
141 ListBuffer<JCCompilationUnit> packTrees = new ListBuffer<JCCompilationUnit>(); |
141 ListBuffer<JCCompilationUnit> packTrees = new ListBuffer<>(); |
142 |
142 |
143 try { |
143 try { |
144 StandardJavaFileManager fm = docenv.fileManager instanceof StandardJavaFileManager |
144 StandardJavaFileManager fm = docenv.fileManager instanceof StandardJavaFileManager |
145 ? (StandardJavaFileManager) docenv.fileManager : null; |
145 ? (StandardJavaFileManager) docenv.fileManager : null; |
146 for (List<String> it = javaNames; it.nonEmpty(); it = it.tail) { |
146 for (List<String> it = javaNames; it.nonEmpty(); it = it.tail) { |
224 docenv.notice("main.Loading_source_files_for_package", name); |
224 docenv.notice("main.Loading_source_files_for_package", name); |
225 |
225 |
226 if (files == null) { |
226 if (files == null) { |
227 Location location = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH) |
227 Location location = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH) |
228 ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH; |
228 ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH; |
229 ListBuffer<JavaFileObject> lb = new ListBuffer<JavaFileObject>(); |
229 ListBuffer<JavaFileObject> lb = new ListBuffer<>(); |
230 for (JavaFileObject fo: docenv.fileManager.list( |
230 for (JavaFileObject fo: docenv.fileManager.list( |
231 location, name, EnumSet.of(JavaFileObject.Kind.SOURCE), false)) { |
231 location, name, EnumSet.of(JavaFileObject.Kind.SOURCE), false)) { |
232 String binaryName = docenv.fileManager.inferBinaryName(location, fo); |
232 String binaryName = docenv.fileManager.inferBinaryName(location, fo); |
233 String simpleName = getSimpleName(binaryName); |
233 String simpleName = getSimpleName(binaryName); |
234 if (isValidClassName(simpleName)) { |
234 if (isValidClassName(simpleName)) { |
257 private Map<String,List<JavaFileObject>> searchSubPackages( |
257 private Map<String,List<JavaFileObject>> searchSubPackages( |
258 List<String> subPackages, |
258 List<String> subPackages, |
259 ListBuffer<String> packages, |
259 ListBuffer<String> packages, |
260 List<String> excludedPackages) |
260 List<String> excludedPackages) |
261 throws IOException { |
261 throws IOException { |
262 Map<String,List<JavaFileObject>> packageFiles = |
262 Map<String,List<JavaFileObject>> packageFiles = new HashMap<>(); |
263 new HashMap<String,List<JavaFileObject>>(); |
263 |
264 |
264 Map<String,Boolean> includedPackages = new HashMap<>(); |
265 Map<String,Boolean> includedPackages = new HashMap<String,Boolean>(); |
|
266 includedPackages.put("", true); |
265 includedPackages.put("", true); |
267 for (String p: excludedPackages) |
266 for (String p: excludedPackages) |
268 includedPackages.put(p, false); |
267 includedPackages.put(p, false); |
269 |
268 |
270 StandardLocation path = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH) |
269 StandardLocation path = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH) |
425 |
424 |
426 /** |
425 /** |
427 * From a list of top level trees, return the list of contained class definitions |
426 * From a list of top level trees, return the list of contained class definitions |
428 */ |
427 */ |
429 List<JCClassDecl> listClasses(List<JCCompilationUnit> trees) { |
428 List<JCClassDecl> listClasses(List<JCCompilationUnit> trees) { |
430 ListBuffer<JCClassDecl> result = new ListBuffer<JCClassDecl>(); |
429 ListBuffer<JCClassDecl> result = new ListBuffer<>(); |
431 for (JCCompilationUnit t : trees) { |
430 for (JCCompilationUnit t : trees) { |
432 for (JCTree def : t.defs) { |
431 for (JCTree def : t.defs) { |
433 if (def.hasTag(JCTree.Tag.CLASSDEF)) |
432 if (def.hasTag(JCTree.Tag.CLASSDEF)) |
434 result.append((JCClassDecl)def); |
433 result.append((JCClassDecl)def); |
435 } |
434 } |