com.sun.tools.javac.api
public class: JavacScope [javadoc |
source]
java.lang.Object
com.sun.tools.javac.api.JavacScope
All Implemented Interfaces:
Scope
Provides an implementation of Scope.
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:
Jonathan
- Gibbons;
Field Summary |
---|
protected final Env<AttrContext> | env | |
Constructor: |
JavacScope(Env<AttrContext> env) {
env.getClass(); // null-check
this.env = env;
}
Creates a new instance of JavacScope |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from com.sun.tools.javac.api.JavacScope Detail: |
public boolean equals(Object other) {
if (other instanceof JavacScope) {
JavacScope s = (JavacScope) other;
return (env.equals(s.env)
&& isStarImportScope() == s.isStarImportScope());
} else
return false;
}
|
public TypeElement getEnclosingClass() {
// hide the dummy class that javac uses to enclose the top level declarations
return (env.outer == null || env.outer == env ? null : env.enclClass.sym);
}
|
public ExecutableElement getEnclosingMethod() {
return (env.enclMethod == null ? null : env.enclMethod.sym);
}
|
public JavacScope getEnclosingScope() {
if (env.outer != null && env.outer != env)
return new JavacScope(env.outer);
else {
// synthesize an outermost "star-import" scope
return new JavacScope(env) {
public boolean isStarImportScope() {
return true;
}
public JavacScope getEnclosingScope() {
return null;
}
public Iterable< ? extends Element > getLocalElements() {
return env.toplevel.starImportScope.getElements();
}
};
}
}
|
public Env<AttrContext> getEnv() {
return env;
}
|
public Iterable<Element> getLocalElements() {
return env.info.getLocalElements();
}
|
public int hashCode() {
return env.hashCode() + (isStarImportScope() ? 1 : 0);
}
|
public boolean isStarImportScope() {
return false;
}
|
public String toString() {
return "JavacScope[env=" + env + ",starImport=" + isStarImportScope() + "]";
}
|