|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.tools.javac.tree.JCTree.Visitor
com.sun.tools.javac.comp.MemberEnter
public class MemberEnter
This is the second phase of Enter, in which classes are completed by entering their members into the class scope using MemberEnter.complete(). See Enter for an overview.
This is NOT part of any API supported by Sun Microsystems. 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.
| Field Summary | |
|---|---|
private Annotate |
annotate
|
private Attr |
attr
|
(package private) static boolean |
checkClash
A switch to determine whether we check for package/class conflicts |
private Check |
chk
|
(package private) boolean |
completionEnabled
A flag to disable completion from time to time during member enter, as we only need to look up types. |
private JCDiagnostic.Factory |
diags
|
private Enter |
enter
|
protected Env<AttrContext> |
env
Visitor argument: the current environment |
(package private) ListBuffer<Env<AttrContext>> |
halfcompleted
A queue for classes whose members still need to be entered into the symbol table. |
(package private) boolean |
isFirst
Set to true only when the first of a set of classes is processed from the halfcompleted queue. |
private Log |
log
|
private TreeMaker |
make
|
protected static Context.Key<MemberEnter> |
memberEnterKey
|
private Names |
names
|
private ClassReader |
reader
|
private boolean |
skipAnnotations
|
private Symtab |
syms
|
private Target |
target
|
private Todo |
todo
|
private Types |
types
|
| Constructor Summary | |
|---|---|
protected |
MemberEnter(Context context)
|
| Method Summary | |
|---|---|
private void |
addEnumMembers(JCTree.JCClassDecl tree,
Env<AttrContext> env)
Add the implicit members for an enum type to the symbol table. |
(package private) void |
annotateDefaultValueLater(JCTree.JCExpression defaultValue,
Env<AttrContext> localEnv,
Symbol.MethodSymbol m)
Queue processing of an attribute default value. |
(package private) void |
annotateLater(List<JCTree.JCAnnotation> annotations,
Env<AttrContext> localEnv,
Symbol s)
Queue annotations for later processing. |
(package private) Type |
attribImportType(JCTree tree,
Env<AttrContext> env)
|
private Env<AttrContext> |
baseEnv(JCTree.JCClassDecl tree,
Env<AttrContext> env)
|
void |
complete(Symbol sym)
Complete entering a class. |
(package private) JCTree |
DefaultConstructor(TreeMaker make,
Symbol.ClassSymbol c,
List<Type> typarams,
List<Type> argtypes,
List<Type> thrown,
long flags,
boolean based)
Generate default constructor for given class. |
private void |
enterAnnotations(List<JCTree.JCAnnotation> annotations,
Env<AttrContext> env,
Symbol s)
Enter a set of annotations. |
private void |
enterDefaultValue(JCTree.JCExpression defaultValue,
Env<AttrContext> localEnv,
Symbol.MethodSymbol m)
Enter a default value for an attribute method. |
private JCTree.JCExpression |
enumBase(int pos,
Symbol.ClassSymbol c)
Generate a base clause for an enum type. |
private void |
finish(Env<AttrContext> env)
Enter member fields and methods of a class |
(package private) void |
finishClass(JCTree.JCClassDecl tree,
Env<AttrContext> env)
Enter members for a class. |
Env<AttrContext> |
getInitEnv(JCTree.JCVariableDecl tree,
Env<AttrContext> env)
|
Env<AttrContext> |
getMethodEnv(JCTree.JCMethodDecl tree,
Env<AttrContext> env)
|
private boolean |
hasDeprecatedAnnotation(List<JCTree.JCAnnotation> annotations)
Check if a list of annotations contains a reference to java.lang.Deprecated. |
private void |
importAll(int pos,
Symbol.TypeSymbol tsym,
Env<AttrContext> env)
Import all classes of a class or package on demand. |
private void |
importNamed(JCDiagnostic.DiagnosticPosition pos,
Symbol tsym,
Env<AttrContext> env)
Import given class. |
private void |
importNamedStatic(JCDiagnostic.DiagnosticPosition pos,
Symbol.TypeSymbol tsym,
Name name,
Env<AttrContext> env)
Import statics types of a given name. |
private void |
importStaticAll(int pos,
Symbol.TypeSymbol tsym,
Env<AttrContext> env)
Import all static members of a class or package on demand. |
(package private) Env<AttrContext> |
initEnv(JCTree.JCVariableDecl tree,
Env<AttrContext> env)
Create a fresh environment for a variable's initializer. |
static MemberEnter |
instance(Context context)
|
protected void |
memberEnter(JCTree tree,
Env<AttrContext> env)
Enter field and method definitions and process import clauses, catching any completion failure exceptions. |
(package private) void |
memberEnter(List<? extends JCTree> trees,
Env<AttrContext> env)
Enter members from a list of trees. |
(package private) Env<AttrContext> |
methodEnv(JCTree.JCMethodDecl tree,
Env<AttrContext> env)
Create a fresh environment for method bodies. |
(package private) Type |
signature(List<JCTree.JCTypeParameter> typarams,
List<JCTree.JCVariableDecl> params,
JCTree res,
List<JCTree.JCExpression> thrown,
Env<AttrContext> env)
Construct method type from method signature. |
(package private) boolean |
staticImportAccessible(Symbol sym,
Symbol.PackageSymbol packge)
|
(package private) JCTree.JCExpressionStatement |
SuperCall(TreeMaker make,
List<Type> typarams,
List<JCTree.JCVariableDecl> params,
boolean based)
Generate call to superclass constructor. |
void |
visitErroneous(JCTree.JCErroneous tree)
|
void |
visitImport(JCTree.JCImport tree)
|
void |
visitMethodDef(JCTree.JCMethodDecl tree)
|
void |
visitTopLevel(JCTree.JCCompilationUnit tree)
|
void |
visitTree(JCTree tree)
Default member enter visitor method: do nothing |
void |
visitVarDef(JCTree.JCVariableDecl tree)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final Context.Key<MemberEnter> memberEnterKey
static final boolean checkClash
private final Names names
private final Enter enter
private final Log log
private final Check chk
private final Attr attr
private final Symtab syms
private final TreeMaker make
private final ClassReader reader
private final Todo todo
private final Annotate annotate
private final Types types
private final JCDiagnostic.Factory diags
private final Target target
private final boolean skipAnnotations
ListBuffer<Env<AttrContext>> halfcompleted
boolean isFirst
boolean completionEnabled
protected Env<AttrContext> env
| Constructor Detail |
|---|
protected MemberEnter(Context context)
| Method Detail |
|---|
public static MemberEnter instance(Context context)
private void importAll(int pos,
Symbol.TypeSymbol tsym,
Env<AttrContext> env)
pos - Position to be used for error reporting.tsym - The class or package the members of which are imported.toScope - The (import) scope in which imported classes
are entered.
private void importStaticAll(int pos,
Symbol.TypeSymbol tsym,
Env<AttrContext> env)
pos - Position to be used for error reporting.tsym - The class or package the members of which are imported.toScope - The (import) scope in which imported classes
are entered.
boolean staticImportAccessible(Symbol sym,
Symbol.PackageSymbol packge)
private void importNamedStatic(JCDiagnostic.DiagnosticPosition pos,
Symbol.TypeSymbol tsym,
Name name,
Env<AttrContext> env)
pos - Position to be used for error reporting.tsym - The class from which the name is imported.name - The (simple) name being imported.env - The environment containing the named import
scope to add to.
private void importNamed(JCDiagnostic.DiagnosticPosition pos,
Symbol tsym,
Env<AttrContext> env)
pos - Position to be used for error reporting.tsym - The class to be imported.env - The environment containing the named import
scope to add to.
Type signature(List<JCTree.JCTypeParameter> typarams,
List<JCTree.JCVariableDecl> params,
JCTree res,
List<JCTree.JCExpression> thrown,
Env<AttrContext> env)
typarams - The method's type parameters.params - The method's value parameters.res - The method's result type,
null if it is a constructor.thrown - The method's thrown exceptions.env - The method's (local) environment.
protected void memberEnter(JCTree tree,
Env<AttrContext> env)
void memberEnter(List<? extends JCTree> trees,
Env<AttrContext> env)
void finishClass(JCTree.JCClassDecl tree,
Env<AttrContext> env)
private void addEnumMembers(JCTree.JCClassDecl tree,
Env<AttrContext> env)
public void visitTopLevel(JCTree.JCCompilationUnit tree)
visitTopLevel in class JCTree.Visitorpublic void visitImport(JCTree.JCImport tree)
visitImport in class JCTree.Visitorpublic void visitMethodDef(JCTree.JCMethodDecl tree)
visitMethodDef in class JCTree.Visitor
Env<AttrContext> methodEnv(JCTree.JCMethodDecl tree,
Env<AttrContext> env)
tree - The method definition.env - The environment current outside of the method definition.public void visitVarDef(JCTree.JCVariableDecl tree)
visitVarDef in class JCTree.Visitor
Env<AttrContext> initEnv(JCTree.JCVariableDecl tree,
Env<AttrContext> env)
tree - The variable definition.env - The environment current outside of the variable definition.public void visitTree(JCTree tree)
visitTree in class JCTree.Visitorpublic void visitErroneous(JCTree.JCErroneous tree)
visitErroneous in class JCTree.Visitor
public Env<AttrContext> getMethodEnv(JCTree.JCMethodDecl tree,
Env<AttrContext> env)
public Env<AttrContext> getInitEnv(JCTree.JCVariableDecl tree,
Env<AttrContext> env)
Type attribImportType(JCTree tree,
Env<AttrContext> env)
void annotateLater(List<JCTree.JCAnnotation> annotations,
Env<AttrContext> localEnv,
Symbol s)
private boolean hasDeprecatedAnnotation(List<JCTree.JCAnnotation> annotations)
private void enterAnnotations(List<JCTree.JCAnnotation> annotations,
Env<AttrContext> env,
Symbol s)
void annotateDefaultValueLater(JCTree.JCExpression defaultValue,
Env<AttrContext> localEnv,
Symbol.MethodSymbol m)
private void enterDefaultValue(JCTree.JCExpression defaultValue,
Env<AttrContext> localEnv,
Symbol.MethodSymbol m)
public void complete(Symbol sym)
throws Symbol.CompletionFailure
complete in interface Symbol.Completersym - The symbol of the class to be completed.
Symbol.CompletionFailure
private Env<AttrContext> baseEnv(JCTree.JCClassDecl tree,
Env<AttrContext> env)
private void finish(Env<AttrContext> env)
env - the environment current for the class block.
private JCTree.JCExpression enumBase(int pos,
Symbol.ClassSymbol c)
pos - The position for trees and diagnostics, if anyc - The class symbol of the enum
JCTree DefaultConstructor(TreeMaker make,
Symbol.ClassSymbol c,
List<Type> typarams,
List<Type> argtypes,
List<Type> thrown,
long flags,
boolean based)
make - The tree factory.c - The class owning the default constructor.argtypes - The parameter types of the constructor.thrown - The thrown exceptions of the constructor.based - Is first parameter a this$n?
JCTree.JCExpressionStatement SuperCall(TreeMaker make,
List<Type> typarams,
List<JCTree.JCVariableDecl> params,
boolean based)
make - The tree factoryparams - The parameters that need to be passed to supertyparams - The type parameters that need to be passed to superbased - Is first parameter a this$n?
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||