public abstract class Symbol extends AnnoConstruct implements Element
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.
Modifier and Type | Class and Description |
---|---|
static class |
Symbol.ClassSymbol
A class for class symbols
|
static interface |
Symbol.Completer
Symbol completer interface.
|
static class |
Symbol.CompletionFailure |
static class |
Symbol.DelegatedSymbol<T extends Symbol> |
static class |
Symbol.DynamicMethodSymbol
A class for invokedynamic method calls.
|
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 base class for Symbols representing types.
|
static class |
Symbol.TypeVariableSymbol
Type variables are represented by instances of this class.
|
static class |
Symbol.VarSymbol
A class for variable symbols
|
static interface |
Symbol.Visitor<R,P>
A visitor for symbols.
|
Modifier and Type | Field and Description |
---|---|
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.
|
protected SymbolMetadata |
metadata
The attributes of this symbol are contained in this
SymbolMetadata.
|
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 and Description |
---|
Symbol(int kind,
long flags,
Name name,
Type type,
Symbol owner)
Construct a symbol with given kind, flags, name, type and owner.
|
Modifier and Type | Method and Description |
---|---|
<R,P> R |
accept(Symbol.Visitor<R,P> v,
P p) |
boolean |
annotationsPendingCompletion() |
void |
appendAttributes(List<Attribute.Compound> l) |
void |
appendClassInitTypeAttributes(List<Attribute.TypeCompound> l) |
void |
appendInitTypeAttributes(List<Attribute.TypeCompound> l) |
void |
appendTypeAttributesWithCompletion(Annotate.AnnotateRepeatedContext<Attribute.TypeCompound> ctx) |
void |
appendUniqueTypeAttributes(List<Attribute.TypeCompound> 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 |
baseSymbol() |
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.
|
List<Attribute.Compound> |
getAnnotationMirrors()
This is the implementation for
javax.lang.model.element.Element.getAnnotationMirrors() . |
List<Attribute.TypeCompound> |
getClassInitTypeAttributes() |
List<Attribute.Compound> |
getDeclarationAttributes() |
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.
|
List<Attribute.TypeCompound> |
getInitTypeAttributes() |
ElementKind |
getKind()
Returns the
kind of this element. |
SymbolMetadata |
getMetadata()
This method is intended for debugging only.
|
Set<Modifier> |
getModifiers()
Returns the modifiers of this element, excluding annotations.
|
Name |
getQualifiedName()
The fully qualified name of this symbol.
|
List<Attribute.Compound> |
getRawAttributes()
An accessor method for the attributes of this symbol.
|
List<Attribute.TypeCompound> |
getRawTypeAttributes()
An accessor method for the type attributes of this symbol.
|
Name |
getSimpleName()
Returns the simple (unqualified) name of this element.
|
List<Symbol.TypeVariableSymbol> |
getTypeParameters() |
boolean |
hasAnnotations() |
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.
|
boolean |
hasTypeAnnotations() |
boolean |
isAnonymous()
Has this symbol an empty name? This includes anonymous
inner classes.
|
boolean |
isConstructor()
Is this symbol a constructor?
|
boolean |
isDeprecated() |
boolean |
isEnclosedBy(Symbol.ClassSymbol clazz)
Is this symbol the same as or enclosed by the given class?
|
boolean |
isEnum() |
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 |
isPrivate() |
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 |
prependAttributes(List<Attribute.Compound> l) |
void |
resetAnnotations() |
void |
setAttributes(Symbol other) |
void |
setDeclarationAttributes(List<Attribute.Compound> a) |
void |
setDeclarationAttributesWithCompletion(Annotate.AnnotateRepeatedContext<Attribute.Compound> ctx) |
void |
setTypeAttributes(List<Attribute.TypeCompound> a) |
String |
toString()
The Java source which this symbol represents.
|
getAnnotation, getAnnotationsByType, getAttribute, getInheritedAnnotations
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
accept, equals, getAnnotation, hashCode
getAnnotationsByType
public int kind
Kinds
public long flags_field
public Name name
public Type type
public Symbol owner
public Symbol.Completer completer
public Type erasure_field
protected SymbolMetadata metadata
public long flags()
public List<Attribute.Compound> getRawAttributes()
public List<Attribute.TypeCompound> getRawTypeAttributes()
public Attribute.Compound attribute(Symbol anno)
public boolean annotationsPendingCompletion()
public void appendAttributes(List<Attribute.Compound> l)
public void appendClassInitTypeAttributes(List<Attribute.TypeCompound> l)
public void appendInitTypeAttributes(List<Attribute.TypeCompound> l)
public void appendTypeAttributesWithCompletion(Annotate.AnnotateRepeatedContext<Attribute.TypeCompound> ctx)
public void appendUniqueTypeAttributes(List<Attribute.TypeCompound> l)
public List<Attribute.TypeCompound> getClassInitTypeAttributes()
public List<Attribute.TypeCompound> getInitTypeAttributes()
public List<Attribute.Compound> getDeclarationAttributes()
public boolean hasAnnotations()
public boolean hasTypeAnnotations()
public void prependAttributes(List<Attribute.Compound> l)
public void resetAnnotations()
public void setAttributes(Symbol other)
public void setDeclarationAttributes(List<Attribute.Compound> a)
public void setDeclarationAttributesWithCompletion(Annotate.AnnotateRepeatedContext<Attribute.Compound> ctx)
public void setTypeAttributes(List<Attribute.TypeCompound> a)
public SymbolMetadata getMetadata()
public Symbol clone(Symbol newOwner)
public <R,P> R accept(Symbol.Visitor<R,P> v, P p)
public String toString()
public Symbol location()
public Symbol baseSymbol()
public Type externalType(Types types)
public boolean isDeprecated()
public boolean isStatic()
public boolean isInterface()
public boolean isPrivate()
public boolean isEnum()
public boolean isLocal()
public boolean isAnonymous()
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)
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.
public Symbol getEnclosingElement()
Element
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.public 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
PackageElement.getSimpleName()
,
ExecutableElement.getSimpleName()
,
TypeElement.getSimpleName()
,
VariableElement.getSimpleName()
public List<Attribute.Compound> getAnnotationMirrors()
javax.lang.model.element.Element.getAnnotationMirrors()
.getAnnotationMirrors
in interface AnnotatedConstruct
getAnnotationMirrors
in interface Element
getAnnotationMirrors
in class AnnoConstruct
public List<Symbol> getEnclosedElements()
Element
Note that elements of certain kinds can be isolated using
methods in ElementFilter
.
getEnclosedElements
in interface Element
PackageElement.getEnclosedElements()
,
TypeElement.getEnclosedElements()
,
Elements.getAllMembers(javax.lang.model.element.TypeElement)
public List<Symbol.TypeVariableSymbol> getTypeParameters()
Copyright © 2015. All rights reserved.