APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.tools.javac.api

public Class JavacTrees

extends DocTrees
Class Inheritance
Imports
java.io.FileNotFoundException, .IOException, java.text.BreakIterator, java.util.HashMap, .HashSet, .Map, .Map.Entry, .ServiceLoader, .Set, .WeakHashMap, javax.annotation.processing.ProcessingEnvironment, javax.lang.model.element.AnnotationMirror, .AnnotationValue, .Element, .ElementKind, .ExecutableElement, .Modifier, .NestingKind, .PackageElement, .TypeElement, javax.lang.model.type.DeclaredType, .TypeKind, .TypeMirror, javax.lang.model.util.Elements.DocCommentKind, javax.tools.Diagnostic, .FileObject, .ForwardingFileObject, .JavaCompiler, .JavaFileManager, .JavaFileObject, .JavaFileObject.Kind, .StandardLocation, com.sun.source.doctree.DocCommentTree, .DocTree, .EntityTree, com.sun.source.tree.CatchTree, .ClassTree, .CompilationUnitTree, .Scope, .Tree, com.sun.source.util.DocSourcePositions, .DocTreePath, .DocTrees, .JavacTask, .TreePath, com.sun.tools.javac.code.Flags, .Scope.NamedImportScope, .Scope.StarImportScope, .Scope.WriteableScope, .Symbol, .Symbol.ClassSymbol, .Symbol.MethodSymbol, .Symbol.ModuleSymbol, .Symbol.PackageSymbol, .Symbol.TypeSymbol, .Symbol.VarSymbol, .Symtab, .Type, .Type.ArrayType, .Type.ClassType, .Type.UnionClassType, .Types, com.sun.tools.javac.comp.Attr, .AttrContext, .Check, .Enter, .Env, .MemberEnter, .Modules, .Resolve, com.sun.tools.javac.file.BaseFileManager, com.sun.tools.javac.model.JavacElements, com.sun.tools.javac.parser.DocCommentParser, .ParserFactory, .ReferenceParser, .Tokens.Comment, com.sun.tools.javac.processing.JavacProcessingEnvironment, com.sun.tools.javac.resources.CompilerProperties.Errors, .CompilerProperties.Notes, .CompilerProperties.Warnings, com.sun.tools.javac.tree.DCTree, .DCTree.DCDocComment, .DCTree.DCIdentifier, .DCTree.DCParam, .DCTree.DCReference, .DocCommentTable, .DocTreeMaker, .JCTree, .JCTree.JCBlock, .JCTree.JCCatch, .JCTree.JCClassDecl, .JCTree.JCCompilationUnit, .JCTree.JCExpression, .JCTree.JCIdent, .JCTree.JCMethodDecl, .JCTree.JCVariableDecl, .TreeCopier, .TreeInfo, .TreeMaker, .TreeScanner, com.sun.tools.javac.util.Abort, .Assert, .Context, .DefinedBy, .DefinedBy.Api, .DiagnosticSource, .JCDiagnostic, .JCDiagnostic.DiagnosticFlag, .List, .ListBuffer, .Log, .Name, .Names, .Pair, .Position

Provides an implementation of Trees.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Author
Peter von der Ahé

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
JavacTrees.Copier

Makes a copy of a tree, noting the value resulting from copying a particular leaf.

public static interface
JavacTrees.DocCommentTreeTransformer

An interface for transforming a DocCommentTree.

private static class
public static class
JavacTrees.IdentityTransformer

A class that provides the identity transform on instances of DocCommentTree.

Field Summary

Modifier and TypeField and Description
private final Attr
private BreakIterator
private final Check
private JavacTrees.DocCommentTreeTransformer
private final DocTreeMaker
private final JavacElements
private final Enter
private final Map<Type, Type>
private final JavaFileManager
private final JavacTaskImpl
private final Log
private final MemberEnter
private final Modules
private final Names
private final ParserFactory
private final Resolve
private final Symtab
private final TreeMaker
private final Types

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
pack-priv static JavaFileObject
private Env<AttrContext>
private Env<AttrContext>
private Symbol
private Symbol
protected JavacTrees.Copier
pack-priv Symbol.MethodSymbol
findConstructor(Symbol.ClassSymbol tsym, List<Type> paramTypes, boolean strict)

private Symbol.VarSymbol
findField(Symbol.ClassSymbol tsym, Name fieldName, boolean explicitType)

private Symbol.MethodSymbol
findMethod(Symbol.ClassSymbol tsym, Name methodName, List<Type> paramTypes, boolean strict, boolean explicitType)

private void
private Env<AttrContext>
public BreakIterator
getBreakIterator()

Implements abstract com.sun.source.util.DocTrees.getBreakIterator.

Returns the break iterator used to compute the first sentence of documentation comments.

public String
getCharacters(EntityTree tree)

Implements abstract com.sun.source.util.DocTrees.getCharacters.

Returns a string containing the characters for the entity in a given entity tree, or null if the tree does not represent a valid series of characters.

public String
getDocComment(TreePath path)

Implements abstract com.sun.source.util.Trees.getDocComment.

Returns the doc comment, if any, for the Tree node identified by a given TreePath.

public Elements.DocCommentKind
getDocCommentKind(TreePath path)

Implements abstract com.sun.source.util.DocTrees.getDocCommentKind.

Returns the style of the documentation comment associated with a tree node.

public DocCommentTree
getDocCommentTree(TreePath path)

Implements abstract com.sun.source.util.DocTrees.getDocCommentTree.

Returns the doc comment tree, if any, for the Tree node identified by a given TreePath.

public DocCommentTree
getDocCommentTree(Element e)

Implements abstract com.sun.source.util.DocTrees.getDocCommentTree.

Returns the doc comment tree of the given element.

public DocCommentTree
getDocCommentTree(Element e, String relativeFileName)

Implements abstract com.sun.source.util.DocTrees.getDocCommentTree.

Returns the doc comment tree of the given file, which must be of one of the supported file types, and whose path is specified relative to the given element.

public DocCommentTree
getDocCommentTree(FileObject fileObject)

Implements abstract com.sun.source.util.DocTrees.getDocCommentTree.

Returns the doc comment tree of the given file, which must be of one of the supported file types.

public DocCommentTree

Returns:

the doc comment tree for a given comment
getDocCommentTree
(DiagnosticSource
the source containing the comment, used when displaying any diagnostics
diagSource
,
Tokens.Comment
the comment
c
)

Returns the doc comment tree for a given comment.

public JavacTrees.DocCommentTreeTransformer
public DocTreeMaker
getDocTreeFactory()

Implements abstract com.sun.source.util.DocTrees.getDocTreeFactory.

Returns a utility object for creating DocTree objects.

public DocTreePath
getDocTreePath(FileObject fileObject, PackageElement packageElement)

Implements abstract com.sun.source.util.DocTrees.getDocTreePath.

Returns a doc tree path containing the doc comment tree of the given file, which must be of one of the supported file types.

public Symbol
getElement(TreePath path)

Implements abstract com.sun.source.util.Trees.getElement.

Returns the Element for the Tree node identified by a given TreePath.

public Element
getElement(DocTreePath path)

Implements abstract com.sun.source.util.DocTrees.getElement.

Returns the language model element referred to by the leaf node of the given DocTreePath, or null if the leaf node of path does not refer to an element.

public List<DocTree>
getFirstSentence(List<? extends DocTree> list)

Implements abstract com.sun.source.util.DocTrees.getFirstSentence.

Returns the list of DocTree representing the first sentence of a comment.

public TypeMirror
getLub(CatchTree tree)

Implements abstract com.sun.source.util.Trees.getLub.

Returns the lub of an exception parameter declared in a catch clause.

public TypeMirror

Returns:

TypeMirror corresponding to the original type, replaced by the ErrorType. noType (type.tag == NONE) is returned if there is no original type.
getOriginalType
(ErrorType
The errorType for which we want to get the original type.
errorType
)

Implements abstract com.sun.source.util.Trees.getOriginalType.

Returns the original type from the ErrorType object.

public ParserFactory

Returns:

the ParserFactory parser factory
getParserFactory
()

Returns the ParserFactory parser factory.

public TreePath
getPath(CompilationUnitTree unit, Tree node)

Implements abstract com.sun.source.util.Trees.getPath.

Returns the path to tree node within the specified compilation unit.

public TreePath
getPath(Element e)

Implements abstract com.sun.source.util.Trees.getPath.

Returns the TreePath node for a given Element.

public TreePath
getPath(Element e, AnnotationMirror a)

Implements abstract com.sun.source.util.Trees.getPath.

Returns the TreePath node for an AnnotationMirror on a given Element.

public TreePath
getPath(Element e, AnnotationMirror a, AnnotationValue v)

Implements abstract com.sun.source.util.Trees.getPath.

Returns the TreePath node for an AnnotationValue for an AnnotationMirror on a given Element.

public JavacScope
getScope(TreePath path)

Implements abstract com.sun.source.util.Trees.getScope.

Returns the Scope for the Tree node identified by a given TreePath.

public DocSourcePositions
getSourcePositions()

Implements abstract com.sun.source.util.DocTrees.getSourcePositions.

Returns a utility object for accessing the source positions of documentation tree nodes.

public JCTree.JCClassDecl
getTree(TypeElement element)

Implements abstract com.sun.source.util.Trees.getTree.

Returns the ClassTree node for a given TypeElement.

public JCTree.JCMethodDecl
getTree(ExecutableElement method)

Implements abstract com.sun.source.util.Trees.getTree.

Returns the MethodTree node for a given ExecutableElement.

public JCTree
getTree(Element element)

Implements abstract com.sun.source.util.Trees.getTree.

Returns the Tree node for a given Element.

public JCTree
getTree(Element e, AnnotationMirror a)

Implements abstract com.sun.source.util.Trees.getTree.

Returns the Tree node for an AnnotationMirror on a given Element.

public JCTree
getTree(Element e, AnnotationMirror a, AnnotationValue v)

Implements abstract com.sun.source.util.Trees.getTree.

Returns the Tree node for an AnnotationValue for an AnnotationMirror on a given Element.

public TypeMirror
getType(DocTreePath path)

Implements abstract com.sun.source.util.DocTrees.getType.

Returns the language model type referred to by the leaf node of the given DocTreePath, or null if the leaf node of path does not refer to a type.

public TypeMirror
getTypeMirror(TreePath path)

Implements abstract com.sun.source.util.Trees.getTypeMirror.

Returns the TypeMirror for the Tree node identified by a given TreePath.

private boolean
hasParameterTypes(Symbol.MethodSymbol method, List<Type> paramTypes, boolean strict)

public void
initDocCommentTreeTransformer()

Initialize docCommentTreeTransformer if it is null, using a service provider to look up an implementation with the name "standard".

public static JavacTrees
instance(JavaCompiler.CompilationTask task)

Hides com.sun.source.util.DocTrees.instance.

Returns a DocTrees object for a given CompilationTask.

public static JavacTrees
instance(ProcessingEnvironment env)

Hides com.sun.source.util.DocTrees.instance.

Returns a DocTrees object for a given ProcessingEnvironment.

public static JavacTrees
instance(Context context)

public boolean
isAccessible(Scope scope, TypeElement type)

Implements abstract com.sun.source.util.Trees.isAccessible.

Checks whether a given type is accessible in a given scope.

public boolean
isAccessible(Scope scope, Element member, DeclaredType type)

Implements abstract com.sun.source.util.Trees.isAccessible.

Checks whether the given element is accessible as a member of the given type in a given scope.

private static boolean
private static boolean
private TreePath
private Map<JCTree.JCClassDecl, Name>
public void
printMessage(Diagnostic.Kind
the kind of message
kind
,
CharSequence
the message, or an empty string if none
msg
,
Tree
the tree to use as a position hint
t
,
CompilationUnitTree
the compilation unit that contains tree
root
)

Implements abstract com.sun.source.util.Trees.printMessage.

Prints a message of the specified kind at the location of the tree within the provided compilation unit

public void
printMessage(Diagnostic.Kind kind, CharSequence msg, DocTree t, DocCommentTree c, CompilationUnitTree root)

Implements abstract com.sun.source.util.DocTrees.printMessage.

Prints a message of the specified kind at the location of the tree within the provided compilation unit.

public void
private void
private Symbol
resolveMember(Type type, Name memberName, DCTree.DCReference ref, Env<AttrContext> env)

private Symbol.VarSymbol
searchField(Symbol.ClassSymbol tsym, Name fieldName, boolean explicitType, Set<Symbol.ClassSymbol> searched)

private Symbol.MethodSymbol
searchMethod(Symbol.ClassSymbol tsym, Name methodName, List<Type> paramTypes, boolean strict, boolean explicitType, Set<Symbol.ClassSymbol> searched)

public void
setBreakIterator(BreakIterator breakiterator)

Implements abstract com.sun.source.util.DocTrees.setBreakIterator.

Sets the break iterator to compute the first sentence of documentation comments.

public void
private DocCommentTree

Returns:

the transformed tree
transform
(DocCommentTree
the tree
tree
)

Transforms the given tree using the current transformer, after ensuring it has been initialized.