|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.tools.javac.code.Symbol
public abstract class Symbol
Root class for Java symbols. It contains subclasses for specific sorts of symbols, such as variables, methods and operators, types, packages. Each subclass is represented as a static inner class inside Symbol.
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 | |
---|---|
static class |
Symbol.ClassSymbol
A class for class symbols |
static interface |
Symbol.Completer
Symbol completer interface. |
static class |
Symbol.CompletionFailure
|
static class |
Symbol.DelegatedSymbol
|
static class |
Symbol.Level
|
static class |
Symbol.MethodSymbol
A class for method symbols. |
static class |
Symbol.OperatorSymbol
A class for predefined operators. |
static class |
Symbol.PackageSymbol
A class for package symbols |
static class |
Symbol.TypeSymbol
A class for type symbols. |
static class |
Symbol.VarSymbol
A class for variable symbols |
static interface |
Symbol.Visitor<R,P>
A visitor for symbols. |
Field Summary | |
---|---|
List<Attribute.Compound> |
attributes_field
The attributes of this symbol. |
Symbol.Completer |
completer
The completer of this symbol. |
Type |
erasure_field
A cache for the type erasure of this symbol. |
long |
flags_field
The flags of this symbol. |
int |
kind
The kind of this symbol. |
Symbol.Level |
level
|
Name |
name
The name of this symbol in Utf8 representation. |
Symbol |
owner
The owner of this symbol. |
Type |
type
The type of this symbol. |
Constructor Summary | |
---|---|
Symbol(int kind,
long flags,
Name name,
Type type,
Symbol owner)
Construct a symbol with given kind, flags, name, type and owner. |
Method Summary | ||
---|---|---|
|
accept(Symbol.Visitor<R,P> v,
P p)
|
|
void |
addParentLevel(Symbol.Level l)
|
|
Symbol |
asMemberOf(Type site,
Types types)
The (variable or method) symbol seen as a member of given class type`site' (this might change the symbol's type). |
|
Type |
asType()
Returns the type defined by this element. |
|
Attribute.Compound |
attribute(Symbol anno)
Fetch a particular annotation from a symbol. |
|
Symbol |
clone(Symbol newOwner)
Clone this symbol with new owner. |
|
void |
complete()
Complete the elaboration of this symbol's definition. |
|
Symbol.ClassSymbol |
enclClass()
The closest enclosing class of this symbol's declaration. |
|
Type |
erasure(Types types)
The symbol's erased type. |
|
boolean |
exists()
True if the symbol represents an entity that exists. |
|
Type |
externalType(Types types)
The external type of a symbol. |
|
long |
flags()
An accessor method for the flags of this symbol. |
|
Name |
flatName()
The fully qualified name of this symbol after converting to flat representation. |
|
|
getAnnotation(java.lang.Class<A> annoType)
Deprecated. this method should never be used by javac internally. |
|
List<Attribute.Compound> |
getAnnotationMirrors()
An accessor method for the attributes of this symbol. |
|
java.util.List<Symbol> |
getEnclosedElements()
Returns the elements that are, loosely speaking, directly enclosed by this element. |
|
Symbol |
getEnclosingElement()
Returns the innermost element within which this element is, loosely speaking, enclosed. |
|
ElementKind |
getKind()
Returns the kind of this element. |
|
int |
getLevel()
|
|
java.util.Set<Modifier> |
getModifiers()
Returns the modifiers of this element, excluding annotations. |
|
Name |
getQualifiedName()
The fully qualified name of this symbol. |
|
Name |
getSimpleName()
Returns the simple (unqualified) name of this element. |
|
List<Symbol.TypeSymbol> |
getTypeParameters()
|
|
boolean |
hasOuterInstance()
An inner class has an outer instance if it is not an interface it has an enclosing instance class which might be referenced from the class. |
|
private boolean |
hiddenIn(Symbol.ClassSymbol clazz,
Types types)
Check for hiding. |
|
boolean |
isConstructor()
Is this symbol a constructor? |
|
boolean |
isEnclosedBy(Symbol.ClassSymbol clazz)
Is this symbol the same as or enclosed by the given class? |
|
boolean |
isInheritedIn(Symbol clazz,
Types types)
Is this symbol inherited into a given class? PRE: If symbol's owner is a interface, it is already assumed that the interface is a superinterface of given class. |
|
boolean |
isInner()
A class is an inner class if it it has an enclosing instance class. |
|
boolean |
isInterface()
|
|
boolean |
isLocal()
Is this symbol declared (directly or indirectly) local to a method or variable initializer? Also includes fields of inner classes which are in turn local to a method or variable initializer. |
|
boolean |
isMemberOf(Symbol.TypeSymbol clazz,
Types types)
Fully check membership: hierarchy, protection, and hiding. |
|
boolean |
isStatic()
|
|
boolean |
isSubClass(Symbol base,
Types types)
Is this symbol a subclass of `base'? Only defined for ClassSymbols. |
|
Symbol |
location()
A Java source description of the location of this symbol; used for error reporting. |
|
Symbol |
location(Type site,
Types types)
|
|
Scope |
members()
If this is a class or package, its members, otherwise null. |
|
Symbol.ClassSymbol |
outermostClass()
The outermost class which indirectly owns this symbol. |
|
boolean |
overrides(Symbol _other,
Symbol.TypeSymbol origin,
Types types,
boolean checkResult)
Does this method symbol override `other' symbol, when both are seen as members of class `origin'? It is assumed that _other is a member of origin. |
|
Symbol.PackageSymbol |
packge()
The package which indirectly owns this symbol. |
|
void |
removeParentLevel(Symbol.Level l)
|
|
java.lang.String |
toString()
The Java source which this symbol represents. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.lang.model.element.Element |
---|
accept, equals, hashCode |
Field Detail |
---|
public int kind
Kinds
public long flags_field
public List<Attribute.Compound> attributes_field
public Name name
public Type type
public Symbol owner
public Symbol.Completer completer
public Type erasure_field
public Symbol.Level level
Constructor Detail |
---|
public Symbol(int kind, long flags, Name name, Type type, Symbol owner)
Method Detail |
---|
public long flags()
public List<Attribute.Compound> getAnnotationMirrors()
getAnnotationMirrors
in interface Element
ElementFilter
public Attribute.Compound attribute(Symbol anno)
public Symbol clone(Symbol newOwner)
public <R,P> R accept(Symbol.Visitor<R,P> v, P p)
public java.lang.String toString()
toString
in class java.lang.Object
public int getLevel()
public void addParentLevel(Symbol.Level l)
public void removeParentLevel(Symbol.Level l)
public Symbol location()
public Symbol location(Type site, Types types)
public Type erasure(Types types)
public Type externalType(Types types)
public boolean isStatic()
public boolean isInterface()
public boolean isLocal()
public boolean isConstructor()
public Name getQualifiedName()
public Name flatName()
public Scope members()
public boolean isInner()
public boolean hasOuterInstance()
isInner()
public Symbol.ClassSymbol enclClass()
public Symbol.ClassSymbol outermostClass()
public Symbol.PackageSymbol packge()
public boolean isSubClass(Symbol base, Types types)
public boolean isMemberOf(Symbol.TypeSymbol clazz, Types types)
public boolean isEnclosedBy(Symbol.ClassSymbol clazz)
private boolean hiddenIn(Symbol.ClassSymbol clazz, Types types)
public boolean isInheritedIn(Symbol clazz, Types types)
clazz
- The class for which we want to establish membership.
This must be a subclass of the member's owner.public Symbol asMemberOf(Type site, Types types)
public boolean overrides(Symbol _other, Symbol.TypeSymbol origin, Types types, boolean checkResult)
public void complete() throws Symbol.CompletionFailure
Symbol.CompletionFailure
public boolean exists()
public Type asType()
Element
A generic element defines a family of types, not just one.
If this is a generic element, a prototypical type is
returned. This is the element's invocation on the
type variables corresponding to its own formal type parameters.
For example,
for the generic class element C<N extends Number>
,
the parameterized type C<N>
is returned.
The Types
utility interface has more general methods
for obtaining the full range of types defined by an element.
asType
in interface Element
Types
public Symbol getEnclosingElement()
Element
null
is returned.
null
is returned.
getEnclosingElement
in interface Element
null
if there is noneElements.getPackageOf(javax.lang.model.element.Element)
public ElementKind getKind()
Element
kind
of this element.
getKind
in interface Element
public java.util.Set<Modifier> getModifiers()
Element
public
and static
modifiers of interface members, are included.
getModifiers
in interface Element
public Name getSimpleName()
Element
java.util.Set<E>
is "Set"
.
If this element represents an unnamed package, an empty name is
returned. If it represents a constructor, the name "<init>
" is returned. If it represents a static initializer,
the name "<clinit>
" is returned. If it represents an
anonymous class or instance initializer, an empty name is
returned.
getSimpleName
in interface Element
@Deprecated public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> annoType)
Element
null
. The
annotation may be either inherited or directly present on this
element.
The annotation returned by this method could contain an element
whose value is of type Class
.
This value cannot be returned directly: information necessary to
locate and load a class (such as the class loader to use) is
not available, and the class might not be loadable at all.
Attempting to read a Class
object by invoking the relevant
method on the returned annotation
will result in a MirroredTypeException
,
from which the corresponding TypeMirror
may be extracted.
Similarly, attempting to read a Class[]
-valued element
will result in a MirroredTypesException
.
Note: This method is unlike others in this and related interfaces. It operates on runtime reflective information — representations of annotation types currently loaded into the VM — rather than on the representations defined by and used throughout these interfaces. Consequently, calling methods on the returned annotation object can throw many of the exceptions that can be thrown when calling methods on an annotation object returned by core reflection. This method is intended for callers that are written to operate on a known, fixed set of annotation types.
getAnnotation
in interface Element
A
- the annotation typeannoType
- the Class
object corresponding to
the annotation type
null
Element.getAnnotationMirrors()
,
AnnotatedElement.getAnnotation(java.lang.Class)
,
EnumConstantNotPresentException
,
AnnotationTypeMismatchException
,
IncompleteAnnotationException
,
MirroredTypeException
,
MirroredTypesException
public java.util.List<Symbol> getEnclosedElements()
Element
values
and valueOf
methods of an
enum type.
A package encloses the top-level classes and interfaces within
it, but is not considered to enclose subpackages.
Other kinds of elements are not currently considered to enclose
any elements; however, that may change as this API or the
programming language evolves.
Note that elements of certain kinds can be isolated using
methods in ElementFilter
.
getEnclosedElements
in interface Element
Elements.getAllMembers(javax.lang.model.element.TypeElement)
public List<Symbol.TypeSymbol> getTypeParameters()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |