1 /* |
1 /* |
2 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2017, 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 |
37 import java.util.Map; |
37 import java.util.Map; |
38 import java.util.Set; |
38 import java.util.Set; |
39 |
39 |
40 import javax.lang.model.element.Element; |
40 import javax.lang.model.element.Element; |
41 import javax.lang.model.element.ElementKind; |
41 import javax.lang.model.element.ElementKind; |
42 import javax.lang.model.element.ExecutableElement; |
|
43 import javax.lang.model.element.Modifier; |
42 import javax.lang.model.element.Modifier; |
44 import javax.lang.model.element.ModuleElement; |
43 import javax.lang.model.element.ModuleElement; |
45 import javax.lang.model.element.ModuleElement.ExportsDirective; |
44 import javax.lang.model.element.ModuleElement.ExportsDirective; |
46 import javax.lang.model.element.ModuleElement.RequiresDirective; |
45 import javax.lang.model.element.ModuleElement.RequiresDirective; |
47 import javax.lang.model.element.PackageElement; |
46 import javax.lang.model.element.PackageElement; |
48 import javax.lang.model.element.TypeElement; |
47 import javax.lang.model.element.TypeElement; |
49 import javax.lang.model.element.VariableElement; |
|
50 import javax.lang.model.util.ElementFilter; |
48 import javax.lang.model.util.ElementFilter; |
51 import javax.lang.model.util.SimpleElementVisitor9; |
49 import javax.lang.model.util.SimpleElementVisitor9; |
52 import javax.tools.JavaFileManager; |
50 import javax.tools.JavaFileManager; |
53 import javax.tools.JavaFileManager.Location; |
51 import javax.tools.JavaFileManager.Location; |
54 import javax.tools.JavaFileObject; |
52 import javax.tools.JavaFileObject; |
55 import javax.tools.StandardLocation; |
53 import javax.tools.StandardLocation; |
56 |
54 |
57 import com.sun.tools.javac.code.Flags; |
|
58 import com.sun.tools.javac.code.Kinds.Kind; |
55 import com.sun.tools.javac.code.Kinds.Kind; |
59 import com.sun.tools.javac.code.Symbol; |
56 import com.sun.tools.javac.code.Symbol; |
60 import com.sun.tools.javac.code.Symbol.ClassSymbol; |
57 import com.sun.tools.javac.code.Symbol.ClassSymbol; |
61 import com.sun.tools.javac.code.Symbol.CompletionFailure; |
58 import com.sun.tools.javac.code.Symbol.CompletionFailure; |
62 import com.sun.tools.javac.code.Symbol.MethodSymbol; |
|
63 import com.sun.tools.javac.code.Symbol.ModuleSymbol; |
59 import com.sun.tools.javac.code.Symbol.ModuleSymbol; |
64 import com.sun.tools.javac.code.Symbol.PackageSymbol; |
60 import com.sun.tools.javac.code.Symbol.PackageSymbol; |
65 import com.sun.tools.javac.code.Symbol.VarSymbol; |
|
66 import com.sun.tools.javac.code.Symtab; |
61 import com.sun.tools.javac.code.Symtab; |
67 import com.sun.tools.javac.comp.Modules; |
62 import com.sun.tools.javac.comp.Modules; |
68 import com.sun.tools.javac.tree.JCTree.JCClassDecl; |
63 import com.sun.tools.javac.tree.JCTree.JCClassDecl; |
69 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; |
64 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; |
70 import com.sun.tools.javac.util.Context; |
65 import com.sun.tools.javac.util.Context; |
73 import com.sun.tools.javac.util.Names; |
68 import com.sun.tools.javac.util.Names; |
74 import jdk.javadoc.doclet.DocletEnvironment; |
69 import jdk.javadoc.doclet.DocletEnvironment; |
75 import jdk.javadoc.doclet.DocletEnvironment.ModuleMode; |
70 import jdk.javadoc.doclet.DocletEnvironment.ModuleMode; |
76 |
71 |
77 import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE; |
72 import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE; |
|
73 import static javax.tools.JavaFileObject.Kind.*; |
78 import static jdk.javadoc.internal.tool.Main.Result.*; |
74 import static jdk.javadoc.internal.tool.Main.Result.*; |
79 import static jdk.javadoc.internal.tool.JavadocTool.isValidClassName; |
75 import static jdk.javadoc.internal.tool.JavadocTool.isValidClassName; |
|
76 |
80 |
77 |
81 /** |
78 /** |
82 * This class manages elements specified on the command line, and |
79 * This class manages elements specified on the command line, and |
83 * produces "specified" and "included" data sets, needed by the |
80 * produces "specified" and "included" data sets, needed by the |
84 * doclet environment, as well as querying an elements' visibility |
81 * doclet environment, as well as querying an elements' visibility |
862 addAllClasses(list, (TypeElement)isym, filtered); |
859 addAllClasses(list, (TypeElement)isym, filtered); |
863 } |
860 } |
864 } |
861 } |
865 |
862 |
866 private boolean isTypeElementSelected(TypeElement te) { |
863 private boolean isTypeElementSelected(TypeElement te) { |
867 return (xclasses || toolEnv.isFromSource(te)) && isSelected(te); |
864 return (xclasses || toolEnv.getFileKind(te) == SOURCE) && isSelected(te); |
868 } |
865 } |
869 |
866 |
870 SimpleElementVisitor9<Boolean, Void> visibleElementVisitor = null; |
867 SimpleElementVisitor9<Boolean, Void> visibleElementVisitor = null; |
871 /** |
868 /** |
872 * Returns true if the element is selected, by applying |
869 * Returns true if the element is selected, by applying |