|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.tools.javac.comp.Resolve
public class Resolve
Helper class for name resolution, used mostly by the attribution phase.
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.
| Nested Class Summary | |
|---|---|
(package private) class |
Resolve.AccessError
Resolve error class indicating that a symbol is not accessible. |
(package private) class |
Resolve.AmbiguityError
Resolve error class indicating an ambiguous reference. |
(package private) static class |
Resolve.MethodResolutionPhase
|
private class |
Resolve.ResolveError
Root class for resolve errors. |
(package private) class |
Resolve.StaticError
Resolve error class indicating that an instance member was accessed from a static context. |
| Field Summary | |
|---|---|
boolean |
boxingEnabled
|
(package private) Check |
chk
|
private boolean |
debugResolve
|
(package private) JCDiagnostic.Factory |
diags
|
(package private) Infer |
infer
|
(package private) Log |
log
|
(package private) Resolve.ResolveError |
methodNotFound
|
private java.util.Map<Resolve.MethodResolutionPhase,Symbol> |
methodResolutionCache
|
(package private) List<Resolve.MethodResolutionPhase> |
methodResolutionSteps
|
(package private) Names |
names
|
private Formattable.LocalizedString |
noArgs
|
(package private) Warner |
noteWarner
|
(package private) ClassReader |
reader
|
protected static Context.Key<Resolve> |
resolveKey
|
(package private) Symtab |
syms
|
(package private) TreeInfo |
treeinfo
|
(package private) Resolve.ResolveError |
typeNotFound
|
(package private) Types |
types
|
boolean |
varargsEnabled
|
(package private) Resolve.ResolveError |
varNotFound
error symbols, which are returned when resolution fails |
(package private) Resolve.ResolveError |
wrongMethod
|
(package private) Resolve.ResolveError |
wrongMethods
|
| Constructor Summary | |
|---|---|
protected |
Resolve(Context context)
|
| Method Summary | |
|---|---|
(package private) Symbol |
access(Symbol sym,
JCDiagnostic.DiagnosticPosition pos,
Type site,
Name name,
boolean qualified)
Same as above, but without type arguments and arguments. |
(package private) Symbol |
access(Symbol sym,
JCDiagnostic.DiagnosticPosition pos,
Type site,
Name name,
boolean qualified,
List<Type> argtypes,
List<Type> typeargtypes)
If `sym' is a bad symbol: report error and return errSymbol else pass through unchanged, additional arguments duplicate what has been used in trying to find the symbol (--> flyweight pattern). |
(package private) boolean |
argumentsAcceptable(List<Type> argtypes,
List<Type> formals,
boolean allowBoxing,
boolean useVarargs,
Warner warn)
Check if a parameter list accepts a list of args. |
(package private) void |
checkNonAbstract(JCDiagnostic.DiagnosticPosition pos,
Symbol sym)
Check that sym is not an abstract method. |
(package private) Symbol |
findField(Env<AttrContext> env,
Type site,
Name name,
Symbol.TypeSymbol c)
Find field. |
(package private) Symbol |
findFun(Env<AttrContext> env,
Name name,
List<Type> argtypes,
List<Type> typeargtypes,
boolean allowBoxing,
boolean useVarargs)
Find unqualified method matching given name, type and value arguments. |
(package private) Symbol |
findGlobalType(Env<AttrContext> env,
Scope scope,
Name name)
Find a global type in given scope and load corresponding class. |
(package private) Symbol |
findIdent(Env<AttrContext> env,
Name name,
int kind)
Find an unqualified identifier which matches a specified kind set. |
(package private) Symbol |
findIdentInPackage(Env<AttrContext> env,
Symbol.TypeSymbol pck,
Name name,
int kind)
Find an identifier in a package which matches a specified kind set. |
(package private) Symbol |
findIdentInType(Env<AttrContext> env,
Type site,
Name name,
int kind)
Find an identifier among the members of a given type `site'. |
(package private) Symbol |
findMemberType(Env<AttrContext> env,
Type site,
Name name,
Symbol.TypeSymbol c)
Find qualified member type. |
(package private) Symbol |
findMethod(Env<AttrContext> env,
Type site,
Name name,
List<Type> argtypes,
List<Type> typeargtypes,
boolean allowBoxing,
boolean useVarargs,
boolean operator)
Find best qualified method matching given name, type and value arguments. |
private Symbol |
findMethod(Env<AttrContext> env,
Type site,
Name name,
List<Type> argtypes,
List<Type> typeargtypes,
Type intype,
boolean abstractok,
Symbol bestSoFar,
boolean allowBoxing,
boolean useVarargs,
boolean operator)
|
(package private) Symbol |
findType(Env<AttrContext> env,
Name name)
Find an unqualified type symbol. |
(package private) Symbol |
findVar(Env<AttrContext> env,
Name name)
Find unqualified variable or field with given name. |
private Resolve.MethodResolutionPhase |
firstErroneousResolutionPhase()
|
static Resolve |
instance(Context context)
|
(package private) Type |
instantiate(Env<AttrContext> env,
Type site,
Symbol m,
List<Type> argtypes,
List<Type> typeargtypes,
boolean allowBoxing,
boolean useVarargs,
Warner warn)
Same but returns null instead throwing a NoInstanceException |
boolean |
isAccessible(Env<AttrContext> env,
Symbol.TypeSymbol c)
Is class accessible in given evironment? |
(package private) boolean |
isAccessible(Env<AttrContext> env,
Type t)
|
boolean |
isAccessible(Env<AttrContext> env,
Type site,
Symbol sym)
Is symbol accessible as a member of given type in given evironment? |
(package private) static boolean |
isInitializer(Env<AttrContext> env)
An environment is an "initializer" if it is a constructor or an instance initializer. |
private boolean |
isInnerSubClass(Symbol.ClassSymbol c,
Symbol base)
Is given class a subclass of given base class, or an inner class of a subclass? Return null if no such class exists. |
private boolean |
isProtectedAccessible(Symbol sym,
Symbol.ClassSymbol c,
Type site)
Is given protected symbol accessible if it is selected from given site and the selection takes place in given class? |
(package private) static boolean |
isStatic(Env<AttrContext> env)
An environment is "static" if its static level is greater than the one of its outer environment |
(package private) Symbol |
loadClass(Env<AttrContext> env,
Name name)
Load toplevel or member class with given fully qualified name and verify that it is accessible. |
void |
logAccessError(Env<AttrContext> env,
JCTree tree,
Type type)
|
java.lang.Object |
methodArguments(List<Type> argtypes)
|
(package private) Symbol |
mostSpecific(Symbol m1,
Symbol m2,
Env<AttrContext> env,
Type site,
boolean allowBoxing,
boolean useVarargs)
|
(package private) void |
printscopes(Env<AttrContext> env)
|
void |
printscopes(Scope s)
print all scopes starting with scope s and proceeding outwards. |
void |
printscopes(Type t)
|
(package private) Type |
rawInstantiate(Env<AttrContext> env,
Type site,
Symbol m,
List<Type> argtypes,
List<Type> typeargtypes,
boolean allowBoxing,
boolean useVarargs,
Warner warn)
Try to instantiate the type of a method so that it fits given type arguments and argument types. |
(package private) Symbol |
resolveBinaryOperator(JCDiagnostic.DiagnosticPosition pos,
int optag,
Env<AttrContext> env,
Type left,
Type right)
Resolve binary operator. |
(package private) Symbol |
resolveConstructor(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type site,
List<Type> argtypes,
List<Type> typeargtypes)
Resolve constructor. |
Symbol |
resolveConstructor(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type site,
List<Type> argtypes,
List<Type> typeargtypes,
boolean allowBoxing,
boolean useVarargs)
Resolve constructor. |
(package private) Symbol |
resolveIdent(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Name name,
int kind)
Resolve an unqualified (non-method) identifier. |
(package private) Type |
resolveImplicitThis(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type t)
Resolve an appropriate implicit this instance for t's container. |
Symbol.MethodSymbol |
resolveInternalConstructor(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type site,
List<Type> argtypes,
List<Type> typeargtypes)
Resolve a constructor, throw a fatal error if not found. |
Symbol.VarSymbol |
resolveInternalField(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type site,
Name name)
Resolve a field identifier, throw a fatal error if not found. |
Symbol.MethodSymbol |
resolveInternalMethod(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type site,
Name name,
List<Type> argtypes,
List<Type> typeargtypes)
Resolve a qualified method identifier, throw a fatal error if not found. |
(package private) Symbol |
resolveMethod(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Name name,
List<Type> argtypes,
List<Type> typeargtypes)
Resolve an unqualified method identifier. |
(package private) Symbol |
resolveOperator(JCDiagnostic.DiagnosticPosition pos,
int optag,
Env<AttrContext> env,
List<Type> argtypes)
Resolve operator. |
(package private) Symbol |
resolveQualifiedMethod(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type site,
Name name,
List<Type> argtypes,
List<Type> typeargtypes)
Resolve a qualified method identifier |
(package private) Symbol |
resolveSelf(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Symbol.TypeSymbol c,
Name name)
Resolve `c.name' where name == this or name == super. |
(package private) Symbol |
resolveSelfContaining(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Symbol member)
Resolve `c.this' for an enclosing class c that contains the named member. |
(package private) Symbol |
resolveUnaryOperator(JCDiagnostic.DiagnosticPosition pos,
int optag,
Env<AttrContext> env,
Type arg)
Resolve operator. |
(package private) Symbol |
selectBest(Env<AttrContext> env,
Type site,
List<Type> argtypes,
List<Type> typeargtypes,
Symbol sym,
Symbol bestSoFar,
boolean allowBoxing,
boolean useVarargs,
boolean operator)
Select the best method for a call site among two choices. |
| 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<Resolve> resolveKey
Names names
Log log
Symtab syms
Check chk
Infer infer
ClassReader reader
TreeInfo treeinfo
Types types
JCDiagnostic.Factory diags
public final boolean boxingEnabled
public final boolean varargsEnabled
private final boolean debugResolve
final Resolve.ResolveError varNotFound
final Resolve.ResolveError wrongMethod
final Resolve.ResolveError wrongMethods
final Resolve.ResolveError methodNotFound
final Resolve.ResolveError typeNotFound
Warner noteWarner
private final Formattable.LocalizedString noArgs
private java.util.Map<Resolve.MethodResolutionPhase,Symbol> methodResolutionCache
final List<Resolve.MethodResolutionPhase> methodResolutionSteps
| Constructor Detail |
|---|
protected Resolve(Context context)
| Method Detail |
|---|
public static Resolve instance(Context context)
static boolean isStatic(Env<AttrContext> env)
static boolean isInitializer(Env<AttrContext> env)
public boolean isAccessible(Env<AttrContext> env,
Symbol.TypeSymbol c)
env - The current environment.c - The class whose accessibility is checked.
private boolean isInnerSubClass(Symbol.ClassSymbol c,
Symbol base)
c - The class which is the subclass or is contained in it.base - The base class
boolean isAccessible(Env<AttrContext> env,
Type t)
public boolean isAccessible(Env<AttrContext> env,
Type site,
Symbol sym)
env - The current environment.site - The type of which the tested symbol is regarded
as a member.sym - The symbol.
private boolean isProtectedAccessible(Symbol sym,
Symbol.ClassSymbol c,
Type site)
sym - The symbol with protected accessc - The class where the access takes place
Type rawInstantiate(Env<AttrContext> env,
Type site,
Symbol m,
List<Type> argtypes,
List<Type> typeargtypes,
boolean allowBoxing,
boolean useVarargs,
Warner warn)
throws Infer.NoInstanceException
env - The current environmentsite - The type of which the method is a member.m - The method symbol.argtypes - The invocation's given value arguments.typeargtypes - The invocation's given type arguments.allowBoxing - Allow boxing conversions of arguments.useVarargs - Box trailing arguments into an array for varargs.
Infer.NoInstanceException
Type instantiate(Env<AttrContext> env,
Type site,
Symbol m,
List<Type> argtypes,
List<Type> typeargtypes,
boolean allowBoxing,
boolean useVarargs,
Warner warn)
boolean argumentsAcceptable(List<Type> argtypes,
List<Type> formals,
boolean allowBoxing,
boolean useVarargs,
Warner warn)
Symbol findField(Env<AttrContext> env,
Type site,
Name name,
Symbol.TypeSymbol c)
env - The current environment.site - The original type from where the selection takes place.name - The name of the field.c - The class to search for the field. This is always
a superclass or implemented interface of site's class.
public Symbol.VarSymbol resolveInternalField(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type site,
Name name)
pos - The position to use for error reporting.env - The environment current at the method invocation.site - The type of the qualifying expression, in which
identifier is searched.name - The identifier's name.
Symbol findVar(Env<AttrContext> env,
Name name)
env - The current environment.name - The name of the variable or field.
Symbol selectBest(Env<AttrContext> env,
Type site,
List<Type> argtypes,
List<Type> typeargtypes,
Symbol sym,
Symbol bestSoFar,
boolean allowBoxing,
boolean useVarargs,
boolean operator)
env - The current environment.site - The original type from where the
selection takes place.argtypes - The invocation's value arguments,typeargtypes - The invocation's type arguments,sym - Proposed new best match.bestSoFar - Previously found best match.allowBoxing - Allow boxing conversions of arguments.useVarargs - Box trailing arguments into an array for varargs.
Symbol mostSpecific(Symbol m1,
Symbol m2,
Env<AttrContext> env,
Type site,
boolean allowBoxing,
boolean useVarargs)
Symbol findMethod(Env<AttrContext> env,
Type site,
Name name,
List<Type> argtypes,
List<Type> typeargtypes,
boolean allowBoxing,
boolean useVarargs,
boolean operator)
env - The current environment.site - The original type from where the selection
takes place.name - The method's name.argtypes - The method's value arguments.typeargtypes - The method's type argumentsallowBoxing - Allow boxing conversions of arguments.useVarargs - Box trailing arguments into an array for varargs.
private Symbol findMethod(Env<AttrContext> env,
Type site,
Name name,
List<Type> argtypes,
List<Type> typeargtypes,
Type intype,
boolean abstractok,
Symbol bestSoFar,
boolean allowBoxing,
boolean useVarargs,
boolean operator)
Symbol findFun(Env<AttrContext> env,
Name name,
List<Type> argtypes,
List<Type> typeargtypes,
boolean allowBoxing,
boolean useVarargs)
env - The current environment.name - The method's name.argtypes - The method's value arguments.typeargtypes - The method's type arguments.allowBoxing - Allow boxing conversions of arguments.useVarargs - Box trailing arguments into an array for varargs.
Symbol loadClass(Env<AttrContext> env,
Name name)
env - The current environment.name - The fully qualified name of the class to be loaded.
Symbol findMemberType(Env<AttrContext> env,
Type site,
Name name,
Symbol.TypeSymbol c)
env - The current environment.site - The original type from where the selection takes
place.name - The type's name.c - The class to search for the member type. This is
always a superclass or implemented interface of
site's class.
Symbol findGlobalType(Env<AttrContext> env,
Scope scope,
Name name)
env - The current environment.scope - The scope in which to look for the type.name - The type's name.
Symbol findType(Env<AttrContext> env,
Name name)
env - The current environment.name - The type's name.
Symbol findIdent(Env<AttrContext> env,
Name name,
int kind)
env - The current environment.name - The indentifier's name.kind - Indicates the possible symbol kinds
(a subset of VAL, TYP, PCK).
Symbol findIdentInPackage(Env<AttrContext> env,
Symbol.TypeSymbol pck,
Name name,
int kind)
env - The current environment.name - The identifier's name.kind - Indicates the possible symbol kinds
(a nonempty subset of TYP, PCK).
Symbol findIdentInType(Env<AttrContext> env,
Type site,
Name name,
int kind)
env - The current environment.site - The type containing the symbol to be found.name - The identifier's name.kind - Indicates the possible symbol kinds
(a subset of VAL, TYP).
Symbol access(Symbol sym,
JCDiagnostic.DiagnosticPosition pos,
Type site,
Name name,
boolean qualified,
List<Type> argtypes,
List<Type> typeargtypes)
sym - The symbol that was found, or a ResolveError.pos - The position to use for error reporting.site - The original type from where the selection took place.name - The symbol's name.argtypes - The invocation's value arguments,
if we looked for a method.typeargtypes - The invocation's type arguments,
if we looked for a method.
Symbol access(Symbol sym,
JCDiagnostic.DiagnosticPosition pos,
Type site,
Name name,
boolean qualified)
void checkNonAbstract(JCDiagnostic.DiagnosticPosition pos,
Symbol sym)
public void printscopes(Scope s)
void printscopes(Env<AttrContext> env)
public void printscopes(Type t)
Symbol resolveIdent(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Name name,
int kind)
pos - The position to use for error reporting.env - The environment current at the identifier use.name - The identifier's name.kind - The set of admissible symbol kinds for the identifier.
Symbol resolveMethod(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Name name,
List<Type> argtypes,
List<Type> typeargtypes)
pos - The position to use for error reporting.env - The environment current at the method invocation.name - The identifier's name.argtypes - The types of the invocation's value arguments.typeargtypes - The types of the invocation's type arguments.
Symbol resolveQualifiedMethod(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type site,
Name name,
List<Type> argtypes,
List<Type> typeargtypes)
pos - The position to use for error reporting.env - The environment current at the method invocation.site - The type of the qualifying expression, in which
identifier is searched.name - The identifier's name.argtypes - The types of the invocation's value arguments.typeargtypes - The types of the invocation's type arguments.
public Symbol.MethodSymbol resolveInternalMethod(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type site,
Name name,
List<Type> argtypes,
List<Type> typeargtypes)
pos - The position to use for error reporting.env - The environment current at the method invocation.site - The type of the qualifying expression, in which
identifier is searched.name - The identifier's name.argtypes - The types of the invocation's value arguments.typeargtypes - The types of the invocation's type arguments.
Symbol resolveConstructor(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type site,
List<Type> argtypes,
List<Type> typeargtypes)
pos - The position to use for error reporting.env - The environment current at the constructor invocation.site - The type of class for which a constructor is searched.argtypes - The types of the constructor invocation's value
arguments.typeargtypes - The types of the constructor invocation's type
arguments.
public Symbol resolveConstructor(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type site,
List<Type> argtypes,
List<Type> typeargtypes,
boolean allowBoxing,
boolean useVarargs)
pos - The position to use for error reporting.env - The environment current at the constructor invocation.site - The type of class for which a constructor is searched.argtypes - The types of the constructor invocation's value
arguments.typeargtypes - The types of the constructor invocation's type
arguments.allowBoxing - Allow boxing and varargs conversions.useVarargs - Box trailing arguments into an array for varargs.
public Symbol.MethodSymbol resolveInternalConstructor(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type site,
List<Type> argtypes,
List<Type> typeargtypes)
pos - The position to use for error reporting.env - The environment current at the method invocation.site - The type to be constructed.argtypes - The types of the invocation's value arguments.typeargtypes - The types of the invocation's type arguments.
Symbol resolveOperator(JCDiagnostic.DiagnosticPosition pos,
int optag,
Env<AttrContext> env,
List<Type> argtypes)
pos - The position to use for error reporting.optag - The tag of the operation tree.env - The environment current at the operation.argtypes - The types of the operands.
Symbol resolveUnaryOperator(JCDiagnostic.DiagnosticPosition pos,
int optag,
Env<AttrContext> env,
Type arg)
pos - The position to use for error reporting.optag - The tag of the operation tree.env - The environment current at the operation.arg - The type of the operand.
Symbol resolveBinaryOperator(JCDiagnostic.DiagnosticPosition pos,
int optag,
Env<AttrContext> env,
Type left,
Type right)
pos - The position to use for error reporting.optag - The tag of the operation tree.env - The environment current at the operation.left - The types of the left operand.right - The types of the right operand.
Symbol resolveSelf(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Symbol.TypeSymbol c,
Name name)
pos - The position to use for error reporting.env - The environment current at the expression.c - The qualifier.name - The identifier's name.
Symbol resolveSelfContaining(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Symbol member)
pos - The position to use for error reporting.env - The environment current at the expression.member - The member that must be contained in the result.
Type resolveImplicitThis(JCDiagnostic.DiagnosticPosition pos,
Env<AttrContext> env,
Type t)
public void logAccessError(Env<AttrContext> env,
JCTree tree,
Type type)
public java.lang.Object methodArguments(List<Type> argtypes)
private Resolve.MethodResolutionPhase firstErroneousResolutionPhase()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||