APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.javadoc.internal.tool

public Class ElementsTable

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.ArrayList, .Collection, .Collections, .EnumMap, .EnumSet, .HashMap, .HashSet, .LinkedHashMap, .LinkedHashSet, .List, .Map, .Set, javax.lang.model.element.Element, .ElementKind, .Modifier, .ModuleElement, .ModuleElement.ExportsDirective, .ModuleElement.RequiresDirective, .PackageElement, .TypeElement, javax.lang.model.util.ElementFilter, .SimpleElementVisitor14, javax.tools.JavaFileManager, .JavaFileManager.Location, .JavaFileObject, .StandardLocation, com.sun.tools.javac.code.Kinds.Kind, .Source, .Source.Feature, .Symbol, .Symbol.ClassSymbol, .Symbol.CompletionFailure, .Symbol.ModuleSymbol, .Symbol.PackageSymbol, .Symtab, com.sun.tools.javac.comp.Modules, com.sun.tools.javac.main.JavaCompiler, com.sun.tools.javac.tree.JCTree.JCClassDecl, .JCTree.JCCompilationUnit, .JCTree.JCModuleDecl, com.sun.tools.javac.util.Context, .ListBuffer, .Name, .Names, jdk.javadoc.doclet.DocletEnvironment.ModuleMode, jdk.javadoc.internal.doclets.toolkit.WorkArounds

This class manages elements specified on the command line, and produces "specified" and "included" data sets, needed by the doclet environment, as well as querying an elements' visibility or inclusion. A. Initialization phase: the class is initialized with the options table by the caller. Some program elements may not be specified via specific options, such as packages, classes, these are set with the use of setter methods, such setClassArgList and setClassDeclList. B. Scan and decode phase: this is performed by scanSpecifiedItems, to identify the modules specified on the command line, modules specified with qualified packages and qualified subpackages, the modules so identified are used to initialize the module system. C. Intermediate phase: before the final analysis can be done, intermediate methods can be used to get specified elements from the initialization phase, typically used to parse sources or packages specified on the command line. D. Analysis phase: the final analysis is performed to determine the packages that ought to be included, as follows: 1. computes the specified modules, by considering the option "expand-requires", this must be done exhaustively, as the package computation phase expects a completed module graph, in order to check the target of a qualified export is in the included set. 2. computes the packages that must be documented, by considering the option "show-packages", also if only exported packages are to be considered, then also check for qualified packages, and include only those packages whose target is in the included set. 3. compute the specified packages, as part of this, first compute the subpackages and exclude any packages, if required. 4. Finally, compute the types found by previous parsing steps, noting that, all enclosed types (nested types) must also be considered. E. Finally, this class provides methods to obtain the specified sets, which are frozen and cached in the analysis phase, the included sets, are computed lazily and cached for future use. An element can be checked if it should be documented, in which case, the element is checked against the included set and the result is cached, for performance reasons. Definitions: Fully included: an element is included and some or parts of it components are included implicitly, subject to a selection criteria of its enclosed children. Included: if the item should be documented. Rules for processing: 1. A specified element, meaning an element given on the command-line, and exposed via specified elements collections. 2. Expand-contents, an internal pseudo term, meaning it is part of the recursive expansion of specified elements, meaning, the modules are expanded first, then the packages contained in the expanded modules, and then the types contained within the packages, to produce the collections returned by the methods getInclude{Module|Package|Type}Elements(), this is a downward expansion. 3. An included element, meaning it should be documented, and exposed via isIncluded, this enclosing element (module, package) is recursively included.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
private class
pack-priv static class
ElementsTable.ModifierFilter

A class which filters the access flags on classes, fields, methods, etc.

pack-priv static class
ElementsTable.ModulePackage

A container class to retrieve the module and package pair from a parsed qualified package name.

Field Summary

Modifier and TypeField and Description
private final ElementsTable.ModifierFilter
private List<String>
private List<JCTree.JCClassDecl>
private Set<ElementsTable.ModulePackage>
private List<JCTree.JCCompilationUnit>
private final JavaCompiler
private final Map<String, ElementsTable.Entry>
private Set<ElementsTable.ModulePackage>
private final AccessLevel
private final JavaFileManager
pack-priv Map<Symbol.ModuleSymbol, Boolean>
pack-priv boolean
private Set<Element>
private Set<ModuleElement>
private Set<PackageElement>
private Set<TypeElement>
private ElementsTable.IncludedVisitor
private final List<JavaFileManager.Location>
private final JavadocLog
private final Modules
private final Names
private final ToolOptions
private final Set<JavaFileObject.Kind>
private Set<Element>
private Set<ModuleElement>
private Set<PackageElement>
private Set<TypeElement>
private Set<ElementsTable.ModulePackage>
private final Symtab
private final ToolEnvironment
pack-priv SimpleElementVisitor14<Boolean, Void>
pack-priv Set<ModuleElement>
pack-priv final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
ElementsTable(Context
the context to locate commonly used objects
context
,
ToolOptions
the tool options
options
)

Creates the table to manage included and excluded elements.

Method Summary

Modifier and TypeMethod and Description
private void
addAllClasses(Collection<TypeElement> list, TypeElement typeElement, boolean filtered)

Adds all inner classes of this class, and their inner classes recursively, to the list

private void
addAllClasses(Collection<TypeElement> list, PackageElement pkg)

Returns a list of all classes contained in this package, including member classes of those classes, and their member classes, etc.

private void
private void
pack-priv void
analyze()

Performs the final computation and freezes the collections.

pack-priv ElementsTable
private Set<PackageElement>
private void
private void
private void
computeSpecifiedTypes()

Adds all classes as well as inner classes, to the specified list.

private void
private Symbol.ModuleSymbol
private Iterable<JavaFileObject>
fmList(JavaFileManager.Location location, String packagename, Set<JavaFileObject.Kind> kinds, boolean recurse)

private Set<PackageElement>
private ElementsTable.Entry
private ElementsTable.Entry
private List<JavaFileObject>

Returns:

the set of file objects for the specified package
getFiles
(ElementsTable.ModulePackage
the specified package
modpkg
,
boolean recurse)

Returns the set of source files for a package.

pack-priv List<JavaFileObject>

Returns:

a list of java file objects
getFilesToParse
()

Returns an aggregated list of java file objects from the items specified on the command line.

public Set<? extends Element>

Returns:

the set of elements specified on the command line
getIncludedElements
()

Returns a set of elements included elements.

private List<JavaFileManager.Location>
private List<JavaFileManager.Location>
private JavaFileManager.Location
public DocletEnvironment.ModuleMode

Returns:

the module documentation level mode
getModuleMode
()

Returns the module documentation level mode.

private String
private Set<ModuleElement>

Returns:

a set of modules
getModuleRequires
(ModuleElement
the target module element
mdle
,
boolean
true gets all the requires transitive, otherwise gets all the non-transitive requires
onlyTransitive
)

Returns the "requires" modules for the target module.

private String
pack-priv Iterable<ElementsTable.ModulePackage>

Returns:

the aggregate set of included packages and specified subpackages
getPackagesToParse
()

Returns the aggregate set of included packages and specified subpackages.

private String
public Set<? extends Element>

Returns:

the set of elements specified on the command line
getSpecifiedElements
()

Returns a set of elements specified on the command line, including any inner classes.

private boolean
private void
initializeIncludedSets(Set<PackageElement> expandedModulePackages)

public boolean

Returns:

true if included
isIncluded
(Element
the element in question
e
)

Returns true if the given element is included for consideration.

private boolean
public boolean

Returns:

true if the element is visible
isSelected
(Element
the element to be checked
e
)

Returns true if the element is selected, by applying the access filter checks.

private boolean
pack-priv ElementsTable

Returns:

the includes table after setting the specified package names
packages
(Collection<String>
packages on the command line
packageNames
)

Returns an includes table after setting the specified package names.

pack-priv void
pack-priv ElementsTable
pack-priv ElementsTable

Returns:

the include table
setClassArgList
(List<String> classList)

Returns the includes table after setting a class names specified on the command line.

pack-priv ElementsTable

Returns:

the include table
setClassDeclList
(List<JCTree.JCClassDecl> classesDecList)

Returns the includes table after setting the parsed class names.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait