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

public Class TreeMaker

extends Object
implements Factory
Class Inheritance
All Implemented Interfaces
com.sun.tools.javac.tree.JCTree.Factory
Imports
java.util.Iterator, com.sun.source.tree.CaseTree, .ModuleTree.ModuleKind, com.sun.tools.javac.code.*, .Attribute.UnresolvedClass, com.sun.tools.javac.code.Symbol.*, com.sun.tools.javac.code.Type.*, com.sun.tools.javac.util.*, .JCDiagnostic.DiagnosticPosition, com.sun.tools.javac.tree.JCTree.*

Factory class for 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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv TreeMaker.AnnotationBuilder
pack-priv Names
names

The current name table.

public int
pos

The position at which subsequent trees will be created.

pack-priv Symtab
syms

The current symbol table.

public JCTree.JCCompilationUnit
toplevel

The toplevel tree to which created trees belong.

protected static final Context.Key<TreeMaker>
treeMakerKey

The context key for the tree factory.

pack-priv Types

Constructor Summary

AccessConstructor and Description
protected
TreeMaker(Context context)

Create a tree maker with null toplevel and NOPOS as initial position.

protected
TreeMaker(JCTree.JCCompilationUnit toplevel, Names names, Types types, Symtab syms)

Create a tree maker with a given toplevel and FIRSTPOS as initial position.

Method Summary

Modifier and TypeMethod and Description
public JCTree.JCAnnotatedType
AnnotatedType(List<JCTree.JCAnnotation> annotations, JCTree.JCExpression underlyingType)

public JCTree.JCAnnotation
public JCTree.JCAnnotation
Annotation(Attribute a)

Create an annotation tree from an attribute.

public List<JCTree.JCAnnotation>
Annotations(List<Attribute.Compound> attributes)

Create annotation trees from annotations.

public JCTree.JCClassDecl
public JCTree.JCAnyPattern
public JCTree.JCMethodInvocation
App(JCTree.JCExpression meth, List<JCTree.JCExpression> args)

Create a method invocation from a method tree and a list of argument trees.

public JCTree.JCMethodInvocation
App(JCTree.JCExpression meth)

Create a no-arg method invocation from a method tree

public JCTree.JCMethodInvocation
public JCTree.JCAssert
public JCTree.JCAssign
public JCTree.JCStatement
Assignment(Symbol v, JCTree.JCExpression rhs)

Construct an assignment from a variable symbol and a right hand side.

public JCTree.JCAssignOp
public TreeMaker
at(int pos)

Reassign current position.

public TreeMaker
at(JCDiagnostic.DiagnosticPosition pos)

Reassign current position.

public JCTree.JCBinary
public JCTree.JCBindingPattern
public JCTree.JCBlock
public JCTree.JCBreak
public JCTree.JCStatement
Call(JCTree.JCExpression apply)

Wrap a method invocation in an expression statement or return statement, depending on whether the method invocation expression's type is void.

public JCTree.JCCase
public JCTree.JCCatch
public JCTree.JCClassDecl
public JCTree.JCClassDecl
ClassDef(JCTree.JCModifiers mods, Name name, List<JCTree.JCTypeParameter> typarams, JCTree.JCExpression extending, List<JCTree.JCExpression> implementing, List<JCTree.JCExpression> permitting, List<JCTree> defs)

public JCTree.JCExpression
ClassLiteral(Symbol.ClassSymbol clazz)

Create a tree representing a class literal.

public JCTree.JCExpression
ClassLiteral(Type t)

Create a tree representing a class literal.

public JCTree.JCConditional
public JCTree.JCConstantCaseLabel
public JCTree.JCContinue
public JCTree.JCExpression
Create(Symbol ctor, List<JCTree.JCExpression> args)

Create a method invocation from a method tree and a list of argument trees.

public JCTree.JCDefaultCaseLabel
public JCTree.JCDoWhileLoop
public JCTree.JCErroneous
public JCTree.JCErroneous
public JCTree.JCExpressionStatement
public JCTree.JCExports
public JCTree.JCEnhancedForLoop
public JCTree.JCForLoop
public TreeMaker
forToplevel(JCTree.JCCompilationUnit toplevel)

Create a new tree maker for a given toplevel.

public JCTree.JCIdent
public JCTree.JCIdent
Ident(Symbol sym)

Create an identifier from a symbol.

public JCTree.JCExpression
Ident(JCTree.JCVariableDecl param)

Create an identifier that refers to the variable declared in given variable declaration.

public List<JCTree.JCExpression>
Idents(List<JCTree.JCVariableDecl> params)

Create a list of identifiers referring to the variables declared in given list of variable declarations.

public JCTree.JCIf
public JCTree.JCImport
public JCTree.JCArrayAccess
public JCTree.JCArrayAccess
Indexed(Symbol v, JCTree.JCExpression index)

Construct an index expression from a variable and an expression.

public static TreeMaker
instance(Context context)

Get the TreeMaker instance.

pack-priv boolean
isUnqualifiable(Symbol sym)

Can given symbol be referred to in unqualified form?

public JCTree.JCLabeledStatement
public JCTree.JCLambda
public JCTree.LetExpr
public JCTree.LetExpr
public JCTree.JCLiteral
public JCTree.JCLiteral
Literal(Object value)

public JCTree.JCMethodDecl
public JCTree.JCMethodDecl
public JCTree.JCMethodDecl
MethodDef(Symbol.MethodSymbol m, JCTree.JCBlock body)

Create a method definition from a method symbol and a method body.

public JCTree.JCMethodDecl
MethodDef(Symbol.MethodSymbol m, Type mtype, JCTree.JCBlock body)

Create a method definition from a method symbol, method type and a method body.

public JCTree.JCModifiers
public JCTree.JCModifiers
Modifiers(long flags)

public JCTree.JCModuleDecl
public JCTree.JCModuleImport
public JCTree.JCNewArray
public JCTree.JCNewClass
public JCTree.JCOpens
public JCTree.JCPackageDecl
public JCTree.JCVariableDecl
Param(Name name, Type argtype, Symbol owner)

Create a value parameter tree from its name, type, and owner.

public Name
paramName(int i)

The name of synthetic parameter number `i'.

public List<JCTree.JCVariableDecl>
Params(Symbol.MethodSymbol mth)

Create a list of value parameter trees for a method's parameters using the same names as the method's existing parameters.

public List<JCTree.JCVariableDecl>
Params(Symbol.MethodSymbol mth, List<Type> argtypes)

Synthesize a list of parameter trees for a method's parameters.

public JCTree.JCParens
public JCTree.JCPatternCaseLabel
public JCTree.JCProvides
public JCTree.JCExpression
QualIdent(Symbol sym)

Create a qualified identifier from a symbol, adding enough qualifications to make the reference unique.

public JCTree.JCExpression
QualThis(Type t)

Create a tree representing qualified `this' given its type

public JCTree.JCVariableDecl
public JCTree.JCRecordPattern
public JCTree.JCMemberReference
public JCTree.JCRequires
Requires(boolean isTransitive, boolean isStaticPhase, JCTree.JCExpression qualId)

Implements com.sun.tools.javac.tree.JCTree.Factory.Requires.

public JCTree.JCReturn
public JCTree.JCFieldAccess
public JCTree.JCFieldAccess
Select(JCTree.JCExpression
The qualifier tree.
base
,
Symbol sym)

Create a selection node from a qualifier tree and a symbol.

public JCTree.JCSkip
public JCTree.JCNewClass
public JCTree.JCIdent
Super(Type t, Symbol.TypeSymbol owner)

Create a tree representing `super', given its type and owner.

public JCTree.JCSwitch
public JCTree.JCSwitchExpression
public JCTree.JCSynchronized
public JCTree.JCExpression
This(Type t)

Create a tree representing `this', given its type.

public JCTree.JCThrow
public JCTree.JCCompilationUnit
TopLevel(List<JCTree>
a list of PackageDef, ClassDef, Import, and Skip
defs
)

Implements com.sun.tools.javac.tree.JCTree.Factory.TopLevel.

Create given tree node at current position.

public JCTree.JCTry
public JCTree.JCTry
public Name
typaramName(int i)

The name of synthetic type parameter number `i'.

public JCTree.JCExpression
Type(Type t)

Create a tree representing given type.

public JCTree.JCAnnotation
TypeAnnotation(JCTree annotationType, List<JCTree.JCExpression> args)

public JCTree.JCAnnotation
public JCTree.JCTypeApply
public JCTree.JCArrayTypeTree
public JCTree.TypeBoundKind
public JCTree.JCTypeCast
public JCTree.JCTypeCast
TypeCast(Type type, JCTree.JCExpression expr)

Make an attributed type cast expression.

public JCTree.JCPrimitiveTypeTree
public JCTree.JCTypeIntersection
public JCTree.JCTypeParameter
TypeParam(Name name, Type.TypeVar tvar)

Create a type parameter tree from its name and type.

public JCTree.JCTypeParameter
public JCTree.JCTypeParameter
public List<JCTree.JCTypeParameter>
TypeParams(List<Type> typarams)

Create a list of type parameter trees from a list of type variables.

public List<JCTree.JCExpression>
Types(List<Type> ts)

Create a list of trees representing given list of types.

public JCTree.JCInstanceOf
public JCTree.JCTypeUnion
public JCTree.JCUnary
public JCTree.JCUses
public JCTree.JCVariableDecl
public JCTree.JCVariableDecl
public JCTree.JCVariableDecl
VarDef(Symbol.VarSymbol v, JCTree.JCExpression init)

Create a variable definition from a variable symbol and an initializer expression.

public JCTree.JCVarType
public JCTree.JCWhileLoop
public JCTree.JCWildcard
public JCTree.JCYield
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait