APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.tools.javac.code

public abstract Class Symbol

extends AnnoConstruct
implements PoolConstant, Element
Class Inheritance
All Implemented Interfaces
javax.lang.model.element.Element, javax.lang.model.AnnotatedConstruct, com.sun.tools.javac.jvm.PoolConstant
Known Direct Subclasses
com.sun.tools.javac.code.Symbol.DelegatedSymbol, com.sun.tools.javac.code.Symbol.TypeSymbol, com.sun.tools.javac.code.Symbol.VarSymbol, com.sun.tools.javac.code.Symbol.MethodSymbol, com.sun.tools.javac.comp.Resolve.ResolveError
Imports
java.lang.annotation.Annotation, .Inherited, java.util.ArrayList, .Collections, .EnumSet, .HashMap, .Map, .Set, java.util.concurrent.Callable, java.util.function.Supplier, .Predicate, javax.lang.model.element.Element, .ElementKind, .ElementVisitor, .ExecutableElement, .Modifier, .ModuleElement, .NestingKind, .PackageElement, .RecordComponentElement, .TypeElement, .TypeParameterElement, .VariableElement, javax.tools.JavaFileManager, .JavaFileObject, com.sun.tools.javac.code.Kinds.Kind, com.sun.tools.javac.code.Type.*, .Scope.WriteableScope, com.sun.tools.javac.comp.Annotate.AnnotationTypeMetadata, .Attr, .AttrContext, .Env, com.sun.tools.javac.jvm.*, .PoolConstant, com.sun.tools.javac.tree.JCTree, .JCTree.JCAnnotation, .JCTree.JCFieldAccess, .JCTree.JCVariableDecl, .JCTree.Tag, com.sun.tools.javac.util.*, .DefinedBy.Api, .List, .Name

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 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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
Symbol.ClassSymbol

A class for class symbols

public static interface
Symbol.Completer

Symbol completer interface.

public static class
public static class
public static class
Symbol.DynamicMethodSymbol

A class for invokedynamic method calls.

public static class
Symbol.DynamicVarSymbol

A class for condy.

public static class
Symbol.MethodHandleSymbol

A class for method handles.

public static class
Symbol.MethodSymbol

A class for method symbols.

public static enum
public static enum
public static class
Symbol.ModuleSymbol

A class for module symbols.

public static class
Symbol.OperatorSymbol

A class for predefined operators.

public static class
Symbol.PackageSymbol

A class for package symbols

public static class
public static class
public static class
public abstract static class
Symbol.TypeSymbol

A base class for Symbols representing types.

public static class
Symbol.TypeVariableSymbol

Type variables are represented by instances of this class.

public static class
Symbol.VarSymbol

A class for variable symbols

public static interface
Symbol.Visitor<
the return type of the operation implemented by this visitor; use Void if no return type is needed.
R
,
the type of the second argument (the first being the symbol itself) of the operation implemented by this visitor; use Void if a second argument is not needed.
P
>

A visitor for symbols.

Field Summary

Modifier and TypeField and Description
public Symbol.Completer
completer

The completer of this symbol.

public Type
erasure_field

A cache for the type erasure of this symbol.

public long
flags_field

The flags of this symbol.

public Kinds.Kind
kind

The kind of this symbol.

protected SymbolMetadata
metadata

The attributes of this symbol are contained in this SymbolMetadata.

public Name
name

The name of this symbol in Utf8 representation.

public Symbol
owner

The owner of this symbol.

public Type
type

The type of this symbol.

Constructor Summary

AccessConstructor and Description
public
Symbol(Kinds.Kind kind, long flags, Name name, Type type, Symbol owner)

Construct a symbol with given kind, flags, name, type and owner.

Method Summary

Modifier and TypeMethod and Description
public <R, P> R
accept(Symbol.Visitor<R, P> v, P p)

public boolean
public void
public void
public void
public void
public void
public 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).

public Type
asType()

Implements javax.lang.model.element.Element.asType.

Returns the type defined by this element.

public Attribute.Compound
attribute(Symbol anno)

Fetch a particular annotation from a symbol.

public Symbol
public Symbol
clone(Symbol newOwner)

Clone this symbol with new owner.

public void
complete()

Complete the elaboration of this symbol's definition.

public Symbol.ClassSymbol
enclClass()

The closest enclosing class of this symbol's declaration.

public Type
erasure(Types types)

The symbol's erased type.

public boolean
exists()

True if the symbol represents an entity that exists.

public Type
externalType(Types types)

The external type of a symbol.

public long
flags()

An accessor method for the flags of this symbol.

public Name
flatName()

The fully qualified name of this symbol after converting to flat representation.

public List<Attribute.Compound>
getAnnotationMirrors()

Implements abstract com.sun.tools.javac.code.AnnoConstruct.getAnnotationMirrors.

Implements javax.lang.model.element.Element.getAnnotationMirrors, javax.lang.model.AnnotatedConstruct.getAnnotationMirrors.

This is the implementation for javax.lang.model.element.Element.getAnnotationMirrors().

public List<Attribute.TypeCompound>
public List<Attribute.Compound>
public List<Symbol>
getEnclosedElements()

Implements javax.lang.model.element.Element.getEnclosedElements.

Returns the elements that are, loosely speaking, directly enclosed by this element.

public Symbol
getEnclosingElement()

Implements javax.lang.model.element.Element.getEnclosingElement.

Returns the innermost element within which this element is, loosely speaking, enclosed.

public List<Attribute.TypeCompound>
public ElementKind
getKind()

Implements javax.lang.model.element.Element.getKind.

Returns the kind of this element.

public SymbolMetadata
getMetadata()

This method is intended for debugging only.

public Set<Modifier>
getModifiers()

Implements javax.lang.model.element.Element.getModifiers.

Returns the modifiers of this element, excluding annotations.

public Name
getQualifiedName()

The fully qualified name of this symbol.

public List<Attribute.Compound>
getRawAttributes()

An accessor method for the attributes of this symbol.

public List<Attribute.TypeCompound>
getRawTypeAttributes()

An accessor method for the type attributes of this symbol.

public Name
getSimpleName()

Implements javax.lang.model.element.Element.getSimpleName.

Returns the simple (unqualified) name of this element.

public List<Symbol.TypeVariableSymbol>
public boolean
public boolean
public boolean
hasOuterInstance()

An inner class has an outer instance if it is not an interface, enum or record, it has an enclosing instance class which might be referenced from the class.

public boolean
private boolean
private Symbol
hiddenInInternal(Symbol.ClassSymbol currentClass, Types types)

This method looks in the supertypes graph that has the current class as the initial node, till it finds the current symbol or another symbol that hides it.

private SymbolMetadata
public Symbol.ClassSymbol
innermostAccessibleEnclosingClass()

If the class containing this symbol is a local or an anonymous class, then it might be defined inside one or more pre-construction contexts, for which the corresponding enclosing instance is considered inaccessible.

public boolean
public final boolean
isAccessibleIn(Symbol
The class for which we want to establish membership. This must be a subclass of the member's owner.
clazz
,
Types types)

Is this symbol accessible in a given class?

public boolean
isAnonymous()

Has this symbol an empty name?

public boolean
public boolean
isConstructor()

Is this symbol a constructor?

public boolean
public boolean
public boolean
public boolean
isDirectlyOrIndirectlyLocal()

Is this symbol declared (directly or indirectly) local to a method or variable initializer?

public boolean
public boolean
isEnclosedBy(Symbol.ClassSymbol clazz)

Is this symbol the same as or enclosed by the given class?

public boolean
public boolean
public boolean
public boolean
isInheritedIn(Symbol
The class for which we want to establish membership. This must be a subclass of the member's owner.
clazz
,
Types types)

Is this symbol inherited into a given class?

public boolean
isInner()

A class is an inner class if it it has an enclosing instance class.

public boolean
public boolean
isMemberOf(Symbol.TypeSymbol clazz, Types types)

Fully check membership: hierarchy, protection, and hiding.

public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
isSubClass(Symbol base, Types types)

Is this symbol a subclass of `base'?

public Symbol

Returns:

null if the symbol is a package or a toplevel class defined in the default package; otherwise, the owner symbol is returned
location
()

A Java source description of the location of this symbol; used for error reporting.

public Symbol
location(Type site, Types types)

public Scope.WriteableScope
members()

If this is a class or package, its members, otherwise null.

public Symbol.ClassSymbol
outermostClass()

The outermost class which indirectly owns this symbol.

public 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'?

public Symbol.PackageSymbol
packge()

The package which indirectly owns this symbol.

public int
poolTag()

Implements com.sun.tools.javac.jvm.PoolConstant.poolTag.

The constant pool entry tag.

public void
public void
public void
public void
public void
public void
public void
public String
toString()

Overrides java.lang.Object.toString.

The Java source which this symbol represents.

Inherited from com.sun.tools.javac.code.AnnoConstruct:
getAnnotationgetAnnotationsByTypegetAttributegetInheritedAnnotations