Package daikon.config
Class InvariantDoclet
- Object
-
- InvariantDoclet
-
- All Implemented Interfaces:
Doclet
public class InvariantDoclet extends Object implements Doclet
InvariantDoclet is a Javadoc doclet that collects information about the invariants defined within Daikon. Class documentation is collected about each class that is derived (either directly or indirectly) from daikon.inv.Invariant. To specify the output format, use one of the following:--texinfo FILENAME
- Texinfo format, for inclusion in the manual.
--text FILENAME
- Text format, with each name preceded by "+" characters to indicate depth in the tree.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface Doclet
Doclet.Option
-
-
Constructor Summary
Constructors Constructor Description InvariantDoclet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable Boolean
find_enabled(TypeElement cd)
Looks for a field named dkconfig_enabled in the class and find out what it is initialized to.List<Element>
find_fields(TypeElement cd, String prefix)
Look for fields in the specified class that begin with the specified prefix.void
gather_derived_classes(@KeyFor("this.cmap") InvariantDoclet.ClassInfo cd, TreeSet<TypeElement> set)
Gathers up all of the classes under cd and adds them to the specified TreeSet.static String
getBinaryName(TypeElement te)
This method mimics the JDK 8 com.sun.javadoc.Doc.name() method.String
getDocComment(DocCommentTree node)
Fetch the comment string from a DocCommentTree node.String
getName()
Set<? extends Doclet.Option>
getSupportedOptions()
SourceVersion
getSupportedSourceVersion()
void
init(Locale locale, Reporter reporter)
static boolean
isTypeElement(Element element)
Returns true if the given element kind is a type, i.e., a class, enum, interface, or annotation type.void
process_class_sorted_texinfo(PrintStream out, @KeyFor("this.cmap") InvariantDoclet.ClassInfo cd)
Prints a class and all of its derived classes with their documentation in a simple sorted (by name) list in Texinfo format.void
process_class_tree_txt(PrintStream out, InvariantDoclet.ClassInfo cd, int indent)
Prints a class and all of its derived classes as a simple indented tree.boolean
run(DocletEnvironment denv)
Entry point for this doclet (invoked by javadoc).
-
-
-
Constructor Detail
-
InvariantDoclet
public InvariantDoclet()
-
-
Method Detail
-
getBinaryName
public static String getBinaryName(TypeElement te)
This method mimics the JDK 8 com.sun.javadoc.Doc.name() method. It returned a 'non-qualified name' which differs from JDK 11+ javax.lang.model.element.TypeElement.getSimpleName() for a nested class. name() would return 'Outer$Inner' while getSimpleName() returns 'Inner'. Note that this version returns 'Outer.Inner'.- Parameters:
te
- a class TypeElement- Returns:
- the class's 'partially' qualified name
-
getSupportedOptions
public Set<? extends Doclet.Option> getSupportedOptions()
- Specified by:
getSupportedOptions
in interfaceDoclet
-
getSupportedSourceVersion
public SourceVersion getSupportedSourceVersion()
- Specified by:
getSupportedSourceVersion
in interfaceDoclet
-
run
public boolean run(DocletEnvironment denv)
Entry point for this doclet (invoked by javadoc).
-
process_class_tree_txt
public void process_class_tree_txt(PrintStream out, InvariantDoclet.ClassInfo cd, int indent)
Prints a class and all of its derived classes as a simple indented tree.- Parameters:
out
- stream to which to printcd
- starting classindent
- starting indent for the derived class (normally 0)
-
process_class_sorted_texinfo
public void process_class_sorted_texinfo(PrintStream out, @KeyFor("this.cmap") InvariantDoclet.ClassInfo cd)
Prints a class and all of its derived classes with their documentation in a simple sorted (by name) list in Texinfo format. Suitable for inclusion in the manual.- Parameters:
out
- stream to which write outputcd
- class to process
-
gather_derived_classes
public void gather_derived_classes(@KeyFor("this.cmap") InvariantDoclet.ClassInfo cd, TreeSet<TypeElement> set)
Gathers up all of the classes under cd and adds them to the specified TreeSet. They are sorted by their name.- Parameters:
cd
- the base class from which to start the searchset
- the set to add classes to. Should start out empty.
-
find_enabled
public @Nullable Boolean find_enabled(TypeElement cd)
Looks for a field named dkconfig_enabled in the class and find out what it is initialized to.- Parameters:
cd
- class in which to look for dkconfig_enabled- Returns:
- the setting for the dkconfig_enabled variable in the class, or null if no such field
-
find_fields
public List<Element> find_fields(TypeElement cd, String prefix)
Look for fields in the specified class that begin with the specified prefix.- Parameters:
cd
- the class to searchprefix
- string that must be at the beginning of the field name- Returns:
- vector of FieldDoc entries for each field that matches. If no fields are found, a zero length vector is returned (not null).
-
getDocComment
public String getDocComment(DocCommentTree node)
Fetch the comment string from a DocCommentTree node.- Parameters:
node
- the DocCommentTree to process- Returns:
- the entire body of the documentation comment as a string. If no comments are found, an empty string is returned (not null).
-
isTypeElement
public static boolean isTypeElement(Element element)
Returns true if the given element kind is a type, i.e., a class, enum, interface, or annotation type.- Parameters:
element
- the element to test- Returns:
- true, iff the given kind is a type kind
-
-