| java.lang.Object com.sun.tools.javac.tree.JCTree com.sun.tools.javac.comp.Attr
Attr | public class Attr extends JCTree.Visitor (Code) | | This is the main context-dependent analysis phase in GJC. It
encompasses name resolution, type checking and constant folding as
subtasks. Some subtasks involve auxiliary classes.
See Also: Check See Also: Resolve See Also: ConstFold See Also: Infer See Also: This is NOT part of any API supported by Sun Microsystems. If See Also: you write code that depends on this, you do so at your own risk. See Also: This code and its internal interfaces are subject to change or See Also: deletion without notice. |
Method Summary | |
void | attribAnnotationTypes(List<JCAnnotation> annotations, Env<AttrContext> env) Attribute the type references in a list of annotations. | List<Type> | attribArgs(List<JCExpression> trees, Env<AttrContext> env) Attribute the arguments in a method call, returning a list of types. | Type | attribBase(JCTree tree, Env<AttrContext> env, boolean classExpected, boolean interfaceExpected, boolean checkExtensible) Attribute type reference in an `extends' or `implements' clause. | void | attribBounds(List<JCTypeParameter> typarams) | public void | attribClass(DiagnosticPosition pos, ClassSymbol c) Main method: attribute class definition associated with given class symbol. | void | attribClass(ClassSymbol c) Attribute class definition associated with given class symbol. | public Type | attribExpr(JCTree tree, Env<AttrContext> env, Type pt) Derived visitor method: attribute an expression tree. | Type | attribExpr(JCTree tree, Env<AttrContext> env) Derived visitor method: attribute an expression tree with
no constraints on the computed type. | public Env<AttrContext> | attribExprToTree(JCTree expr, Env<AttrContext> env, JCTree tree) | List<Type> | attribExprs(List<JCExpression> trees, Env<AttrContext> env, Type pt) Attribute a list of expressions, returning a list of types. | public Symbol | attribIdent(JCTree tree, JCCompilationUnit topLevel) Attribute a parsed identifier. | public Type | attribStat(JCTree tree, Env<AttrContext> env) Derived visitor method: attribute a statement or definition tree. | public Env<AttrContext> | attribStatToTree(JCTree stmt, Env<AttrContext> env, JCTree tree) | void | attribStats(List<T> trees, Env<AttrContext> env) Attribute a list of statements, returning nothing. | Type | attribTree(JCTree tree, Env<AttrContext> env, int pkind, Type pt) Visitor method: attribute a tree, catching any completion failure
exceptions. | public Type | attribType(JCTree node, TypeSymbol sym) | Type | attribType(JCTree tree, Env<AttrContext> env) Derived visitor method: attribute a type tree. | void | attribTypeVariables(List<JCTypeParameter> typarams, Env<AttrContext> env) Attribute type variables (of generic classes or methods). | List<Type> | attribTypes(List<JCExpression> trees, Env<AttrContext> env) Attribute a type argument list, returning a list of types. | Type | check(JCTree tree, Type owntype, int ownkind, int pkind, Type pt) Check kind and type of given tree against protokind and prototype. | void | checkAssignable(DiagnosticPosition pos, VarSymbol v, JCTree base, Env<AttrContext> env) Check that variable can be assigned to. | Type | checkBase(Type t, JCTree tree, Env<AttrContext> env, boolean classExpected, boolean interfaceExpected, boolean checkExtensible) | boolean | checkFirstConstructorStat(JCMethodInvocation tree, Env<AttrContext> env) Check that given application node appears as first statement
in a constructor call. | Type | checkId(JCTree tree, Type site, Symbol sym, Env<AttrContext> env, int pkind, Type pt, boolean useVarargs) Determine type of identifier or select expression and check that
(1) the referenced symbol is not deprecated
(2) the symbol's type is safe (@see checkSafe)
(3) if symbol is a variable, check that its type and kind are
compatible with the prototype and protokind. | public Type | checkMethod(Type site, Symbol sym, Env<AttrContext> env, List<JCExpression> argtrees, List<Type> argtypes, List<Type> typeargtypes, boolean useVarargs) Check that method arguments conform to its instantation. | public Type | coerce(Type etype, Type ttype) | public static Attr | instance(Context context) | boolean | isAssignableAsBlankFinal(VarSymbol v, Env<AttrContext> env) Is given blank final variable assignable, i.e. | boolean | isStaticReference(JCTree tree) Does tree represent a static reference to an identifier?
It is assumed that tree is either a SELECT or an IDENT. | static boolean | isType(Symbol sym) | Type | litType(int tag) Return the type of a literal with given type tag. | public JCExpression | makeNullCheck(JCExpression arg) Make an attributed null check tree. | Type | newMethTemplate(List<Type> argtypes, List<Type> typeargtypes) Obtain a method type with given argument types. | Symbol | thisSym(DiagnosticPosition pos, Env<AttrContext> env) The current `this' symbol. | public void | visitAnnotation(JCAnnotation tree) | public void | visitApply(JCMethodInvocation tree) Visitor method for method invocations. | public void | visitAssert(JCAssert tree) | public void | visitAssign(JCAssign tree) | public void | visitAssignop(JCAssignOp tree) | public void | visitBinary(JCBinary tree) | public void | visitBlock(JCBlock tree) | public void | visitBreak(JCBreak tree) | public void | visitClassDef(JCClassDecl tree) | public void | visitConditional(JCConditional tree) | public void | visitContinue(JCContinue tree) | public void | visitDoLoop(JCDoWhileLoop tree) | public void | visitErroneous(JCErroneous tree) | public void | visitExec(JCExpressionStatement tree) | public void | visitForLoop(JCForLoop tree) | public void | visitForeachLoop(JCEnhancedForLoop tree) | public void | visitIdent(JCIdent tree) | public void | visitIf(JCIf tree) | public void | visitImport(JCImport tree) | public void | visitIndexed(JCArrayAccess tree) | public void | visitLabelled(JCLabeledStatement tree) | public void | visitLiteral(JCLiteral tree) | public void | visitMethodDef(JCMethodDecl tree) | public void | visitNewArray(JCNewArray tree) | public void | visitNewClass(JCNewClass tree) | public void | visitParens(JCParens tree) | public void | visitReturn(JCReturn tree) | public void | visitSelect(JCFieldAccess tree) | public void | visitSkip(JCSkip tree) | public void | visitSwitch(JCSwitch tree) | public void | visitSynchronized(JCSynchronized tree) | public void | visitThrow(JCThrow tree) | public void | visitTree(JCTree tree) Default visitor method for all other trees. | public void | visitTry(JCTry tree) | public void | visitTypeApply(JCTypeApply tree) Visitor method for parameterized types. | public void | visitTypeArray(JCArrayTypeTree tree) | public void | visitTypeCast(JCTypeCast tree) | public void | visitTypeIdent(JCPrimitiveTypeTree tree) | public void | visitTypeParameter(JCTypeParameter tree) | public void | visitTypeTest(JCInstanceOf tree) | public void | visitUnary(JCUnary tree) | public void | visitVarDef(JCVariableDecl tree) | public void | visitWhileLoop(JCWhileLoop tree) | public void | visitWildcard(JCWildcard tree) |
allowAnonOuterThis | boolean allowAnonOuterThis(Code) | | Switch: allow references to surrounding object from anonymous
objects during constructor call?
|
allowBoxing | boolean allowBoxing(Code) | | Switch: support boxing and unboxing?
|
allowCovariantReturns | boolean allowCovariantReturns(Code) | | Switch: support covariant result types?
|
allowEnums | boolean allowEnums(Code) | | Switch: support enums?
|
allowGenerics | boolean allowGenerics(Code) | | Switch: support generics?
|
allowVarargs | boolean allowVarargs(Code) | | Switch: allow variable-arity methods.
|
pkind | int pkind(Code) | | Visitor argument: the currently expected proto-kind.
|
pt | Type pt(Code) | | Visitor argument: the currently expected proto-type.
|
relax | boolean relax(Code) | | Switch: relax some constraints for retrofit mode.
|
result | Type result(Code) | | Visitor result: the computed type.
|
useBeforeDeclarationWarning | boolean useBeforeDeclarationWarning(Code) | | Switch: warn about use of variable before declaration?
RFE: 6425594
|
attribAnnotationTypes | void attribAnnotationTypes(List<JCAnnotation> annotations, Env<AttrContext> env)(Code) | | Attribute the type references in a list of annotations.
|
attribBase | Type attribBase(JCTree tree, Env<AttrContext> env, boolean classExpected, boolean interfaceExpected, boolean checkExtensible)(Code) | | Attribute type reference in an `extends' or `implements' clause.
Parameters: tree - The tree making up the type reference. Parameters: env - The environment current at the reference. Parameters: classExpected - true if only a class is expected here. Parameters: interfaceExpected - true if only an interface is expected here. |
attribBounds | void attribBounds(List<JCTypeParameter> typarams)(Code) | | |
attribClass | public void attribClass(DiagnosticPosition pos, ClassSymbol c)(Code) | | Main method: attribute class definition associated with given class symbol.
reporting completion failures at the given position.
Parameters: pos - The source position at which completion errors are to bereported. Parameters: c - The class symbol whose definition will be attributed. |
attribClass | void attribClass(ClassSymbol c) throws CompletionFailure(Code) | | Attribute class definition associated with given class symbol.
Parameters: c - The class symbol whose definition will be attributed. |
attribExpr | Type attribExpr(JCTree tree, Env<AttrContext> env)(Code) | | Derived visitor method: attribute an expression tree with
no constraints on the computed type.
|
attribIdent | public Symbol attribIdent(JCTree tree, JCCompilationUnit topLevel)(Code) | | Attribute a parsed identifier.
Parameters: tree - Parsed identifier name Parameters: topLevel - The toplevel to use |
attribStats | void attribStats(List<T> trees, Env<AttrContext> env)(Code) | | Attribute a list of statements, returning nothing.
|
attribTree | Type attribTree(JCTree tree, Env<AttrContext> env, int pkind, Type pt)(Code) | | Visitor method: attribute a tree, catching any completion failure
exceptions. Return the tree's type.
Parameters: tree - The tree to be visited. Parameters: env - The environment visitor argument. Parameters: pkind - The protokind visitor argument. Parameters: pt - The prototype visitor argument. |
attribTypeVariables | void attribTypeVariables(List<JCTypeParameter> typarams, Env<AttrContext> env)(Code) | | Attribute type variables (of generic classes or methods).
Compound types are attributed later in attribBounds.
Parameters: typarams - the type variables to enter Parameters: env - the current environment |
check | Type check(JCTree tree, Type owntype, int ownkind, int pkind, Type pt)(Code) | | Check kind and type of given tree against protokind and prototype.
If check succeeds, store type in tree and return it.
If check fails, store errType in tree and return it.
No checks are performed if the prototype is a method type.
Its not necessary in this case since we know that kind and type
are correct.
Parameters: tree - The tree whose kind and type is checked Parameters: owntype - The computed type of the tree Parameters: ownkind - The computed kind of the tree Parameters: pkind - The expected kind (or: protokind) of the tree Parameters: pt - The expected type (or: prototype) of the tree |
checkAssignable | void checkAssignable(DiagnosticPosition pos, VarSymbol v, JCTree base, Env<AttrContext> env)(Code) | | Check that variable can be assigned to.
Parameters: pos - The current source code position. Parameters: v - The assigned varaible Parameters: base - If the variable is referred to in a Select, the partto the left of the `.', null otherwise. Parameters: env - The current environment. |
checkFirstConstructorStat | boolean checkFirstConstructorStat(JCMethodInvocation tree, Env<AttrContext> env)(Code) | | Check that given application node appears as first statement
in a constructor call.
Parameters: tree - The application node Parameters: env - The environment current at the application. |
checkId | Type checkId(JCTree tree, Type site, Symbol sym, Env<AttrContext> env, int pkind, Type pt, boolean useVarargs)(Code) | | Determine type of identifier or select expression and check that
(1) the referenced symbol is not deprecated
(2) the symbol's type is safe (@see checkSafe)
(3) if symbol is a variable, check that its type and kind are
compatible with the prototype and protokind.
(4) if symbol is an instance field of a raw type,
which is being assigned to, issue an unchecked warning if its
type changes under erasure.
(5) if symbol is an instance method of a raw type, issue an
unchecked warning if its argument types change under erasure.
If checks succeed:
If symbol is a constant, return its constant type
else if symbol is a method, return its result type
otherwise return its type.
Otherwise return errType.
Parameters: tree - The syntax tree representing the identifier Parameters: site - If this is a select, the type of the selectedexpression, otherwise the type of the current class. Parameters: sym - The symbol representing the identifier. Parameters: env - The current environment. Parameters: pkind - The set of expected kinds. Parameters: pt - The expected type. |
isAssignableAsBlankFinal | boolean isAssignableAsBlankFinal(VarSymbol v, Env<AttrContext> env)(Code) | | Is given blank final variable assignable, i.e. in a scope where it
may be assigned to even though it is final?
Parameters: v - The blank final variable. Parameters: env - The current environment. |
isStaticReference | boolean isStaticReference(JCTree tree)(Code) | | Does tree represent a static reference to an identifier?
It is assumed that tree is either a SELECT or an IDENT.
We have to weed out selects from non-type names here.
Parameters: tree - The candidate tree. |
isType | static boolean isType(Symbol sym)(Code) | | Is this symbol a type?
|
litType | Type litType(int tag)(Code) | | Return the type of a literal with given type tag.
|
makeNullCheck | public JCExpression makeNullCheck(JCExpression arg)(Code) | | Make an attributed null check tree.
|
newMethTemplate | Type newMethTemplate(List<Type> argtypes, List<Type> typeargtypes)(Code) | | Obtain a method type with given argument types.
|
thisSym | Symbol thisSym(DiagnosticPosition pos, Env<AttrContext> env)(Code) | | The current `this' symbol.
Parameters: env - The current environment. |
visitAnnotation | public void visitAnnotation(JCAnnotation tree)(Code) | | |
visitApply | public void visitApply(JCMethodInvocation tree)(Code) | | Visitor method for method invocations.
NOTE: The method part of an application will have in its type field
the return type of the method, not the method's type itself!
|
visitAssert | public void visitAssert(JCAssert tree)(Code) | | |
visitAssign | public void visitAssign(JCAssign tree)(Code) | | |
visitAssignop | public void visitAssignop(JCAssignOp tree)(Code) | | |
visitBinary | public void visitBinary(JCBinary tree)(Code) | | |
visitBlock | public void visitBlock(JCBlock tree)(Code) | | |
visitBreak | public void visitBreak(JCBreak tree)(Code) | | |
visitClassDef | public void visitClassDef(JCClassDecl tree)(Code) | | |
visitConditional | public void visitConditional(JCConditional tree)(Code) | | |
visitContinue | public void visitContinue(JCContinue tree)(Code) | | |
visitDoLoop | public void visitDoLoop(JCDoWhileLoop tree)(Code) | | |
visitErroneous | public void visitErroneous(JCErroneous tree)(Code) | | |
visitExec | public void visitExec(JCExpressionStatement tree)(Code) | | |
visitForLoop | public void visitForLoop(JCForLoop tree)(Code) | | |
visitForeachLoop | public void visitForeachLoop(JCEnhancedForLoop tree)(Code) | | |
visitIdent | public void visitIdent(JCIdent tree)(Code) | | |
visitIf | public void visitIf(JCIf tree)(Code) | | |
visitImport | public void visitImport(JCImport tree)(Code) | | |
visitIndexed | public void visitIndexed(JCArrayAccess tree)(Code) | | |
visitLabelled | public void visitLabelled(JCLabeledStatement tree)(Code) | | |
visitLiteral | public void visitLiteral(JCLiteral tree)(Code) | | |
visitMethodDef | public void visitMethodDef(JCMethodDecl tree)(Code) | | |
visitNewArray | public void visitNewArray(JCNewArray tree)(Code) | | |
visitNewClass | public void visitNewClass(JCNewClass tree)(Code) | | |
visitParens | public void visitParens(JCParens tree)(Code) | | |
visitReturn | public void visitReturn(JCReturn tree)(Code) | | |
visitSelect | public void visitSelect(JCFieldAccess tree)(Code) | | |
visitSkip | public void visitSkip(JCSkip tree)(Code) | | |
visitSwitch | public void visitSwitch(JCSwitch tree)(Code) | | |
visitSynchronized | public void visitSynchronized(JCSynchronized tree)(Code) | | |
visitThrow | public void visitThrow(JCThrow tree)(Code) | | |
visitTree | public void visitTree(JCTree tree)(Code) | | Default visitor method for all other trees.
|
visitTry | public void visitTry(JCTry tree)(Code) | | |
visitTypeApply | public void visitTypeApply(JCTypeApply tree)(Code) | | Visitor method for parameterized types.
Bound checking is left until later, since types are attributed
before supertype structure is completely known
|
visitTypeArray | public void visitTypeArray(JCArrayTypeTree tree)(Code) | | |
visitTypeCast | public void visitTypeCast(JCTypeCast tree)(Code) | | |
visitTypeIdent | public void visitTypeIdent(JCPrimitiveTypeTree tree)(Code) | | |
visitTypeParameter | public void visitTypeParameter(JCTypeParameter tree)(Code) | | |
visitTypeTest | public void visitTypeTest(JCInstanceOf tree)(Code) | | |
visitUnary | public void visitUnary(JCUnary tree)(Code) | | |
visitVarDef | public void visitVarDef(JCVariableDecl tree)(Code) | | |
visitWhileLoop | public void visitWhileLoop(JCWhileLoop tree)(Code) | | |
visitWildcard | public void visitWildcard(JCWildcard tree)(Code) | | |
|
|