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

public Class Symtab

extends Object
Class Inheritance
Imports
java.util.Collection, .Collections, .EnumSet, .HashMap, .LinkedHashMap, .Map, javax.lang.model.element.ElementVisitor, com.sun.tools.javac.code.Scope.WriteableScope, .Source.Feature, .Symbol.ClassSymbol, .Symbol.Completer, .Symbol.CompletionFailure, .Symbol.MethodSymbol, .Symbol.ModuleSymbol, .Symbol.PackageSymbol, .Symbol.RootPackageSymbol, .Symbol.TypeSymbol, .Symbol.VarSymbol, .Type.BottomType, .Type.ClassType, .Type.ErrorType, .Type.JCPrimitiveType, .Type.JCVoidType, .Type.MethodType, .Types.UniqueType, com.sun.tools.javac.comp.Modules, com.sun.tools.javac.jvm.Target, com.sun.tools.javac.util.Assert, .Context, .Convert, .DefinedBy, .DefinedBy.Api, .Iterators, .JavacMessages, .List, .Name, .Names

A class that defines all predefined constants and operators as well as special classes such as java.lang.Object, which need to be known to the compiler. All symbols are held in instance fields. This makes it possible to work in multiple concurrent projects, which might use different class files for library classes.

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.

Field Summary

Modifier and TypeField and Description
public final Type
public final Type
public final Symbol.ClassSymbol
arrayClass

The builtin type of all arrays.

public final Symbol.MethodSymbol
public final Type
public final Type
public final Symbol.MethodSymbol
autoCloseableClose

The symbol representing the close method on TWR AutoCloseable type

public final Type
public final Type.JCPrimitiveType
public final Type
public final Symbol.ClassSymbol
boundClass

VGJ: The (singleton) type of all bound types.

public final Name[]
boxedName

The name of the class that belongs to a basic type tag.

public final Type.JCPrimitiveType
byteType

Builtin types.

public final Type.JCPrimitiveType
public final Type
private final Map<Name, Map<Symbol.ModuleSymbol, Symbol.ClassSymbol>>
classes

A hashtable containing the encountered top-level and member classes, indexed by flat names.

private final Map<Types.UniqueType, Symbol.VarSymbol>
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type.JCPrimitiveType
public final Type
private static final Map<Symbol.ModuleSymbol, Symbol.ClassSymbol>
public final Type
public final Symbol.MethodSymbol
enumFinalFinalize

The symbol representing the final finalize method on enums

public final Symbol.TypeSymbol
public final Symbol.ModuleSymbol
errModule

The error module.

public final Type
public final Symbol.ClassSymbol
errSymbol

The error symbol.

public final Type
errType

A value for the errType, with a originalType of noType

public final Type
public final Type
public final Type
public final Type.JCPrimitiveType
public final Type
public final Type
public final Type
public final Type
private final Symbol.Completer
public final Type
public final Type.JCPrimitiveType
public final Type
public final Type
public final Type
public final Symbol.ModuleSymbol
java_base

A symbol for the java.base module.

public final Type
public final Symbol.VarSymbol
lengthVar

The symbol representing the length field of an array.

public final Type
public final Type.JCPrimitiveType
public final Type
private final JavacMessages
public final Symbol.ClassSymbol
methodClass

The builtin type of all methods.

public final Type
public final Type
public final Type
public final Type
private final Symbol.Completer
private final Map<Name, Symbol.ModuleSymbol>
modules

A hashtable giving the encountered modules.

private final Names
public final Type
public final Type
public final Symbol.ModuleSymbol
noModule

A symbol for no module, for use with -source 8 or less

public final Type
public final Symbol.TypeSymbol
noSymbol

A symbol that stands for a missing symbol.

public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
objectType

Predefined types.

public final Type
private final Map<Name, Map<Symbol.ModuleSymbol, Symbol.PackageSymbol>>
packages

A hashtable containing the encountered packages.

public final Symbol.ClassSymbol
predefClass

The class symbol that owns all predefined symbols.

public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Symbol.PackageSymbol
rootPackage

A symbol for the root package.

public final Type
public final Type
public final Type
public final Type.JCPrimitiveType
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
public final Type
protected static final Context.Key<Symtab>
symtabKey

The context key for the symbol table.

public final Type
public final Type
public final Type
public final Type
public final Type[]
typeOfTag

The predefined type that belongs to a tag.

public final Symbol.ClassSymbol
unknownSymbol

The unknown symbol.

public final Type
unknownType

A value for the unknown type.

public final Symbol.ModuleSymbol
unnamedModule

A symbol for the unnamed module.

public final Type
public final Type
public final Type
public final Type.JCVoidType

Constructor Summary

AccessConstructor and Description
protected
Symtab(Context context)

Constructor; enters all predefined identifiers and operators into symbol table.

Method Summary

Modifier and TypeMethod and Description
private void
public Symbol.ClassSymbol
defineClass(Name name, Symbol owner)

Define a new class given its name and owner.

private void
private void
private Type
enterClass(String
The name of the class.
s
)

Enter a class into symbol table.

public Symbol.ClassSymbol
enterClass(Symbol.ModuleSymbol msym, Name name, Symbol.TypeSymbol owner)

Create a new toplevel or member class symbol with given name and owner and enter in `classes' unless already there.

public Symbol.ClassSymbol
enterClass(Symbol.ModuleSymbol msym, Name flatname)

Create a new member or toplevel class symbol with given flat name and enter in `classes' unless already there.

public Symbol.ModuleSymbol
public Symbol.PackageSymbol
enterPackage(Symbol.ModuleSymbol currModule, Name fullname)

Make a package, given its fully qualified name.

private Type
private Type
public Iterable<Symbol.ClassSymbol>
public Collection<Symbol.ModuleSymbol>
public Symbol.ClassSymbol
getClass(Symbol.ModuleSymbol msym, Name flatName)

public Iterable<Symbol.ClassSymbol>
public Symbol.VarSymbol
getClassField(Type type, Types types)

public Symbol.ModuleSymbol
public Symbol.PackageSymbol
getPackage(Symbol.ModuleSymbol module, Name fullname)

public Iterable<Symbol.PackageSymbol>
public Symbol.ModuleSymbol
inferModule(Name packageName)

public void
public void
initType(Type type, String name)

public void
initType(Type type, String name, String bname)

public static Symtab
instance(Context context)

Get the symbol table instance.

public List<Symbol.ModuleSymbol>
listPackageModules(Name packageName)

public Symbol.PackageSymbol
private Symbol.PackageSymbol
lookupPackage(Symbol.ModuleSymbol msym, Name flatName, boolean onlyExisting)

public boolean
packageExists(Symbol.ModuleSymbol msym, Name fullname)

Check to see if a package exists, given its fully qualified name.

public void
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

annotationTargetTypeback to summary
public final Type annotationTargetType
annotationTypeback to summary
public final Type annotationType
arrayClassback to summary
public final Symbol.ClassSymbol arrayClass

The builtin type of all arrays.

arrayCloneMethodback to summary
public final Symbol.MethodSymbol arrayCloneMethod
arraysTypeback to summary
public final Type arraysType
assertionErrorTypeback to summary
public final Type assertionErrorType
autoCloseableCloseback to summary
public final Symbol.MethodSymbol autoCloseableClose

The symbol representing the close method on TWR AutoCloseable type

autoCloseableTypeback to summary
public final Type autoCloseableType
booleanTypeback to summary
public final Type.JCPrimitiveType booleanType
botTypeback to summary
public final Type botType
boundClassback to summary
public final Symbol.ClassSymbol boundClass

VGJ: The (singleton) type of all bound types.

boxedNameback to summary
public final Name[] boxedName

The name of the class that belongs to a basic type tag.

byteTypeback to summary
public final Type.JCPrimitiveType byteType

Builtin types.

charTypeback to summary
public final Type.JCPrimitiveType charType
classDescTypeback to summary
public final Type classDescType
classesback to summary
private final Map<Name, Map<Symbol.ModuleSymbol, Symbol.ClassSymbol>> classes

A hashtable containing the encountered top-level and member classes, indexed by flat names. The table does not contain local classes. It should be updated from the outside to reflect classes defined by compiled source files.

classFieldsback to summary
private final Map<Types.UniqueType, Symbol.VarSymbol> classFields
classLoaderTypeback to summary
public final Type classLoaderType
classNotFoundExceptionTypeback to summary
public final Type classNotFoundExceptionType
classTypeback to summary
public final Type classType
cloneableTypeback to summary
public final Type cloneableType
cloneNotSupportedExceptionTypeback to summary
public final Type cloneNotSupportedExceptionType
collectionsTypeback to summary
public final Type collectionsType
comparableTypeback to summary
public final Type comparableType
comparatorTypeback to summary
public final Type comparatorType
constantBootstrapsTypeback to summary
public final Type constantBootstrapsType
deprecatedTypeback to summary
public final Type deprecatedType
documentedTypeback to summary
public final Type documentedType
doubleTypeback to summary
public final Type.JCPrimitiveType doubleType
elementTypeTypeback to summary
public final Type elementTypeType
EMPTYback to summary
private static final Map<Symbol.ModuleSymbol, Symbol.ClassSymbol> EMPTY
enumDescTypeback to summary
public final Type enumDescType
enumFinalFinalizeback to summary
public final Symbol.MethodSymbol enumFinalFinalize

The symbol representing the final finalize method on enums

enumSymback to summary
public final Symbol.TypeSymbol enumSym
errModuleback to summary
public final Symbol.ModuleSymbol errModule

The error module.

errorTypeback to summary
public final Type errorType
errSymbolback to summary
public final Symbol.ClassSymbol errSymbol

The error symbol.

errTypeback to summary
public final Type errType

A value for the errType, with a originalType of noType

exactConversionsSupportTypeback to summary
public final Type exactConversionsSupportType
exceptionTypeback to summary
public final Type exceptionType
externalizableTypeback to summary
public final Type externalizableType
floatTypeback to summary
public final Type.JCPrimitiveType floatType
functionalInterfaceTypeback to summary
public final Type functionalInterfaceType
illegalArgumentExceptionTypeback to summary
public final Type illegalArgumentExceptionType
incompatibleClassChangeErrorTypeback to summary
public final Type incompatibleClassChangeErrorType
inheritedTypeback to summary
public final Type inheritedType
initialCompleterback to summary
private final Symbol.Completer initialCompleter
interruptedExceptionTypeback to summary
public final Type interruptedExceptionType
intTypeback to summary
public final Type.JCPrimitiveType intType
ioExceptionTypeback to summary
public final Type ioExceptionType
iterableTypeback to summary
public final Type iterableType
iteratorTypeback to summary
public final Type iteratorType
java_baseback to summary
public final Symbol.ModuleSymbol java_base

A symbol for the java.base module.

lambdaMetafactoryback to summary
public final Type lambdaMetafactory
lengthVarback to summary
public final Symbol.VarSymbol lengthVar

The symbol representing the length field of an array.

listTypeback to summary
public final Type listType
longTypeback to summary
public final Type.JCPrimitiveType longType
matchExceptionTypeback to summary
public final Type matchExceptionType
messagesback to summary
private final JavacMessages messages
methodClassback to summary
public final Symbol.ClassSymbol methodClass

The builtin type of all methods.

methodHandleLookupTypeback to summary
public final Type methodHandleLookupType
methodHandlesTypeback to summary
public final Type methodHandlesType
methodHandleTypeback to summary
public final Type methodHandleType
methodTypeTypeback to summary
public final Type methodTypeType
moduleCompleterback to summary
private final Symbol.Completer moduleCompleter
modulesback to summary
private final Map<Name, Symbol.ModuleSymbol> modules

A hashtable giving the encountered modules.

namesback to summary
private final Names names
nativeHeaderTypeback to summary
public final Type nativeHeaderType
noClassDefFoundErrorTypeback to summary
public final Type noClassDefFoundErrorType
noModuleback to summary
public final Symbol.ModuleSymbol noModule

A symbol for no module, for use with -source 8 or less

noSuchFieldErrorTypeback to summary
public final Type noSuchFieldErrorType
noSymbolback to summary
public final Symbol.TypeSymbol noSymbol

A symbol that stands for a missing symbol.

objectInputStreamTypeback to summary
public final Type objectInputStreamType
objectInputTypeback to summary
public final Type objectInputType
objectMethodsTypeback to summary
public final Type objectMethodsType
objectOutputStreamTypeback to summary
public final Type objectOutputStreamType
objectOutputTypeback to summary
public final Type objectOutputType
objectStreamExceptionTypeback to summary
public final Type objectStreamExceptionType
objectStreamFieldTypeback to summary
public final Type objectStreamFieldType
objectsTypeback to summary
public final Type objectsType
objectTypeback to summary
public final Type objectType

Predefined types.

overrideTypeback to summary
public final Type overrideType
packagesback to summary
private final Map<Name, Map<Symbol.ModuleSymbol, Symbol.PackageSymbol>> packages

A hashtable containing the encountered packages. the table should be updated from outside to reflect packages defined by compiled source files.

predefClassback to summary
public final Symbol.ClassSymbol predefClass

The class symbol that owns all predefined symbols.

previewFeatureInternalTypeback to summary
public final Type previewFeatureInternalType
previewFeatureTypeback to summary
public final Type previewFeatureType
profileTypeback to summary
public final Type profileType
proprietaryTypeback to summary
public final Type proprietaryType
recordTypeback to summary
public final Type recordType
repeatableTypeback to summary
public final Type repeatableType
requiresIdentityInternalTypeback to summary
public final Type requiresIdentityInternalType
requiresIdentityTypeback to summary
public final Type requiresIdentityType
restrictedInternalTypeback to summary
public final Type restrictedInternalType
restrictedTypeback to summary
public final Type restrictedType
retentionTypeback to summary
public final Type retentionType
rootPackageback to summary
public final Symbol.PackageSymbol rootPackage

A symbol for the root package.

runtimeExceptionTypeback to summary
public final Type runtimeExceptionType
serializableTypeback to summary
public final Type serializableType
serializedLambdaTypeback to summary
public final Type serializedLambdaType
shortTypeback to summary
public final Type.JCPrimitiveType shortType
stringBufferTypeback to summary
public final Type stringBufferType
stringBuilderTypeback to summary
public final Type stringBuilderType
stringConcatFactoryback to summary
public final Type stringConcatFactory
stringTypeback to summary
public final Type stringType
supplierTypeback to summary
public final Type supplierType
suppressWarningsTypeback to summary
public final Type suppressWarningsType
switchBootstrapsTypeback to summary
public final Type switchBootstrapsType
symtabKeyback to summary
protected static final Context.Key<Symtab> symtabKey

The context key for the symbol table.

systemTypeback to summary
public final Type systemType
throwableTypeback to summary
public final Type throwableType
trustMeTypeback to summary
public final Type trustMeType
typeDescriptorTypeback to summary
public final Type typeDescriptorType
typeOfTagback to summary
public final Type[] typeOfTag

The predefined type that belongs to a tag.

unknownSymbolback to summary
public final Symbol.ClassSymbol unknownSymbol

The unknown symbol.

unknownTypeback to summary
public final Type unknownType

A value for the unknown type.

unnamedModuleback to summary
public final Symbol.ModuleSymbol unnamedModule

A symbol for the unnamed module.

valueBasedInternalTypeback to summary
public final Type valueBasedInternalType
valueBasedTypeback to summary
public final Type valueBasedType
varHandleTypeback to summary
public final Type varHandleType
voidTypeback to summary
public final Type.JCVoidType voidType

Constructor Detail

Symtabback to summary
protected Symtab(Context context) throws CompletionFailure

Constructor; enters all predefined identifiers and operators into symbol table.

Annotations
@SuppressWarnings:this-escape

Method Detail

addRootPackageForback to summary
private void addRootPackageFor(Symbol.ModuleSymbol module)
defineClassback to summary
public Symbol.ClassSymbol defineClass(Name name, Symbol owner)

Define a new class given its name and owner.

doEnterClassback to summary
private void doEnterClass(Symbol.ModuleSymbol msym, Symbol.ClassSymbol cs)
doEnterPackageback to summary
private void doEnterPackage(Symbol.ModuleSymbol msym, Symbol.PackageSymbol pack)
enterClassback to summary
private Type enterClass(String s)

Enter a class into symbol table.

Parameters
s:String

The name of the class.

enterClassback to summary
public Symbol.ClassSymbol enterClass(Symbol.ModuleSymbol msym, Name name, Symbol.TypeSymbol owner)

Create a new toplevel or member class symbol with given name and owner and enter in `classes' unless already there.

enterClassback to summary
public Symbol.ClassSymbol enterClass(Symbol.ModuleSymbol msym, Name flatname)

Create a new member or toplevel class symbol with given flat name and enter in `classes' unless already there.

enterModuleback to summary
public Symbol.ModuleSymbol enterModule(Name name)
enterPackageback to summary
public Symbol.PackageSymbol enterPackage(Symbol.ModuleSymbol currModule, Name fullname)

Make a package, given its fully qualified name.

enterSyntheticAnnotationback to summary
private Type enterSyntheticAnnotation(String name)
enterSyntheticAnnotationback to summary
private Type enterSyntheticAnnotation(Name name)
getAllClassesback to summary
public Iterable<Symbol.ClassSymbol> getAllClasses()
getAllModulesback to summary
public Collection<Symbol.ModuleSymbol> getAllModules()
getClassback to summary
public Symbol.ClassSymbol getClass(Symbol.ModuleSymbol msym, Name flatName)
getClassesForNameback to summary
public Iterable<Symbol.ClassSymbol> getClassesForName(Name candidate)
getClassFieldback to summary
public Symbol.VarSymbol getClassField(Type type, Types types)
getModuleback to summary
public Symbol.ModuleSymbol getModule(Name name)
getPackageback to summary
public Symbol.PackageSymbol getPackage(Symbol.ModuleSymbol module, Name fullname)
getPackagesForNameback to summary
public Iterable<Symbol.PackageSymbol> getPackagesForName(Name candidate)
inferModuleback to summary
public Symbol.ModuleSymbol inferModule(Name packageName)
initTypeback to summary
public void initType(Type type, Symbol.ClassSymbol c)
initTypeback to summary
public void initType(Type type, String name)
initTypeback to summary
public void initType(Type type, String name, String bname)
instanceback to summary
public static Symtab instance(Context context)

Get the symbol table instance.

listPackageModulesback to summary
public List<Symbol.ModuleSymbol> listPackageModules(Name packageName)
lookupPackageback to summary
public Symbol.PackageSymbol lookupPackage(Symbol.ModuleSymbol msym, Name flatName)
lookupPackageback to summary
private Symbol.PackageSymbol lookupPackage(Symbol.ModuleSymbol msym, Name flatName, boolean onlyExisting)
packageExistsback to summary
public boolean packageExists(Symbol.ModuleSymbol msym, Name fullname)

Check to see if a package exists, given its fully qualified name.

removeClassback to summary
public void removeClass(Symbol.ModuleSymbol msym, Name flatName)
synthesizeBoxTypeIfMissingback to summary
public void synthesizeBoxTypeIfMissing(final Type type)
synthesizeEmptyInterfaceIfMissingback to summary
public void synthesizeEmptyInterfaceIfMissing(final Type type)