com.sun.tools.javac.code
Class Symtab

java.lang.Object
  extended by com.sun.tools.javac.code.Symtab

public class Symtab
extends java.lang.Object

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


Field Summary
 Type annotationTargetType
           
 Type annotationType
           
 Symbol.ClassSymbol arrayClass
          The builtin type of all arrays.
 Symbol.MethodSymbol arrayCloneMethod
           
 Type arraysType
           
 Type assertionErrorType
           
 Type booleanType
           
 Type botType
           
 Symbol.ClassSymbol boundClass
          VGJ: The (singleton) type of all bound types.
 Name[] boxedName
          The name of the class that belongs to a basix type tag.
 Type byteType
          Builtin types.
 Type charType
           
 java.util.Map<Name,Symbol.ClassSymbol> classes
          A hashtable containing the encountered top-level and member classes, indexed by flat names.
 Type classLoaderType
           
 Type classNotFoundExceptionType
           
 Type classType
           
 Type cloneableType
           
 Type cloneNotSupportedExceptionType
           
 Type codeType
           
 Type collectionsType
           
 Type comparableType
           
 Type cspMspTreeType
           
 Type deprecatedType
           
 Type doubleType
           
 Symbol.MethodSymbol enumFinalFinalize
          The symbol representing the final finalize method on enums
 Symbol.TypeSymbol enumSym
           
 Type errorType
           
 Symbol.ClassSymbol errSymbol
          The error symbol.
 Type errType
          A value for the errType, with a originalType of noType
 Type exceptionType
           
 Type floatType
           
 Type illegalArgumentExceptionType
           
 Type inheritedType
           
 Type internalMspTreeType
           
 Type intType
           
 Type iterableType
           
 Type iteratorType
           
 Type javaLangVoidType
           
 Symbol.VarSymbol lengthVar
          The symbol representing the length field of an array.
 Type listType
           
 Type longType
           
 Symbol.ClassSymbol methodClass
          The builtin type of all methods.
 Type mspTreeCodeType
           
 Type mspTreeType
           
private  Names names
           
 Type noClassDefFoundErrorType
           
 Type noSuchFieldErrorType
           
 Symbol.TypeSymbol noSymbol
          A symbol that stands for a missing symbol.
 Symbol.OperatorSymbol nullcheck
          The null check operator.
 Type objectType
          Predefined types.
 Type overrideType
           
 java.util.Map<Name,Symbol.PackageSymbol> packages
          A hashtable containing the encountered packages.
 Symbol.ClassSymbol predefClass
          The class symbol that owns all predefined symbols.
 Type proprietaryType
           
private  ClassReader reader
           
 Type retentionType
           
 Symbol.PackageSymbol rootPackage
          A symbol for the root package.
 Type runtimeExceptionType
           
 Type safeCodeType
           
 Type safeMspTreeCodeType
           
 Type serializableType
           
 Type shortType
           
 Type stringBufferType
           
 Type stringBuilderType
           
 Type stringCodeType
           
 Type stringMspTreeType
           
 Type stringType
           
 Type suppressWarningsType
           
protected static Context.Key<Symtab> symtabKey
          The context key for the symbol table.
 Type systemType
           
private  Target target
           
 Type throwableType
           
 Type[] typeOfTag
          The predefined type that belongs to a tag.
 Type unknownType
          A value for the unknown type.
 Symbol.PackageSymbol unnamedPackage
          A symbol for the unnamed package.
 Type.JCNoType voidType
           
 
Constructor Summary
protected Symtab(Context context)
          Constructor; enters all predefined identifiers and operators into symbol table.
 
Method Summary
private  void enterBinop(java.lang.String name, Type left, Type right, Type res, int opcode)
          Enter a binary operation into symbol table.
private  void enterBinop(java.lang.String name, Type left, Type right, Type res, int opcode1, int opcode2)
          Enter a binary operation, as above but with two opcodes, which get encoded as (opcode1 << ByteCodeTags.preShift) + opcode2.
private  Type enterClass(java.lang.String s)
          Enter a class into symbol table.
private  Symbol.VarSymbol enterConstant(java.lang.String name, Type type)
          Enter a constant into symbol table.
private  Symbol.OperatorSymbol enterUnop(java.lang.String name, Type arg, Type res, int opcode)
          Enter a unary operation into symbol table.
 void initType(Type type, java.lang.String name)
           
 void initType(Type type, java.lang.String name, java.lang.String bname)
           
 void initType(Type type, Symbol.ClassSymbol c)
           
static Symtab instance(Context context)
          Get the symbol table instance.
 void synthesizeBoxTypeIfMissing(Type type)
           
 void synthesizeEmptyInterfaceIfMissing(Type type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

symtabKey

protected static final Context.Key<Symtab> symtabKey
The context key for the symbol table.


byteType

public final Type byteType
Builtin types.


charType

public final Type charType

shortType

public final Type shortType

intType

public final Type intType

longType

public final Type longType

floatType

public final Type floatType

doubleType

public final Type doubleType

booleanType

public final Type booleanType

botType

public final Type botType

voidType

public final Type.JCNoType voidType

names

private final Names names

reader

private final ClassReader reader

target

private final Target target

rootPackage

public final Symbol.PackageSymbol rootPackage
A symbol for the root package.


unnamedPackage

public final Symbol.PackageSymbol unnamedPackage
A symbol for the unnamed package.


noSymbol

public final Symbol.TypeSymbol noSymbol
A symbol that stands for a missing symbol.


errSymbol

public final Symbol.ClassSymbol errSymbol
The error symbol.


errType

public final Type errType
A value for the errType, with a originalType of noType


unknownType

public final Type unknownType
A value for the unknown type.


arrayClass

public final Symbol.ClassSymbol arrayClass
The builtin type of all arrays.


arrayCloneMethod

public final Symbol.MethodSymbol arrayCloneMethod

boundClass

public final Symbol.ClassSymbol boundClass
VGJ: The (singleton) type of all bound types.


methodClass

public final Symbol.ClassSymbol methodClass
The builtin type of all methods.


objectType

public final Type objectType
Predefined types.


classType

public final Type classType

classLoaderType

public final Type classLoaderType

stringType

public final Type stringType

stringBufferType

public final Type stringBufferType

stringBuilderType

public final Type stringBuilderType

cloneableType

public final Type cloneableType

serializableType

public final Type serializableType

throwableType

public final Type throwableType

errorType

public final Type errorType

illegalArgumentExceptionType

public final Type illegalArgumentExceptionType

exceptionType

public final Type exceptionType

runtimeExceptionType

public final Type runtimeExceptionType

classNotFoundExceptionType

public final Type classNotFoundExceptionType

noClassDefFoundErrorType

public final Type noClassDefFoundErrorType

noSuchFieldErrorType

public final Type noSuchFieldErrorType

assertionErrorType

public final Type assertionErrorType

cloneNotSupportedExceptionType

public final Type cloneNotSupportedExceptionType

annotationType

public final Type annotationType

enumSym

public final Symbol.TypeSymbol enumSym

listType

public final Type listType

collectionsType

public final Type collectionsType

comparableType

public final Type comparableType

arraysType

public final Type arraysType

iterableType

public final Type iterableType

iteratorType

public final Type iteratorType

annotationTargetType

public final Type annotationTargetType

overrideType

public final Type overrideType

retentionType

public final Type retentionType

deprecatedType

public final Type deprecatedType

suppressWarningsType

public final Type suppressWarningsType

inheritedType

public final Type inheritedType

proprietaryType

public final Type proprietaryType

systemType

public final Type systemType

stringCodeType

public final Type stringCodeType

mspTreeCodeType

public final Type mspTreeCodeType

safeMspTreeCodeType

public final Type safeMspTreeCodeType

mspTreeType

public final Type mspTreeType

stringMspTreeType

public final Type stringMspTreeType

internalMspTreeType

public final Type internalMspTreeType

cspMspTreeType

public final Type cspMspTreeType

codeType

public final Type codeType

safeCodeType

public final Type safeCodeType

javaLangVoidType

public final Type javaLangVoidType

lengthVar

public final Symbol.VarSymbol lengthVar
The symbol representing the length field of an array.


nullcheck

public final Symbol.OperatorSymbol nullcheck
The null check operator.


enumFinalFinalize

public final Symbol.MethodSymbol enumFinalFinalize
The symbol representing the final finalize method on enums


typeOfTag

public final Type[] typeOfTag
The predefined type that belongs to a tag.


boxedName

public final Name[] boxedName
The name of the class that belongs to a basix type tag.


classes

public final java.util.Map<Name,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.


packages

public final java.util.Map<Name,Symbol.PackageSymbol> packages
A hashtable containing the encountered packages. the table should be updated from outside to reflect packages defined by compiled source files.


predefClass

public final Symbol.ClassSymbol predefClass
The class symbol that owns all predefined symbols.

Constructor Detail

Symtab

protected Symtab(Context context)
          throws Symbol.CompletionFailure
Constructor; enters all predefined identifiers and operators into symbol table.

Throws:
Symbol.CompletionFailure
Method Detail

instance

public static Symtab instance(Context context)
Get the symbol table instance.


initType

public void initType(Type type,
                     Symbol.ClassSymbol c)

initType

public void initType(Type type,
                     java.lang.String name)

initType

public void initType(Type type,
                     java.lang.String name,
                     java.lang.String bname)

enterConstant

private Symbol.VarSymbol enterConstant(java.lang.String name,
                                       Type type)
Enter a constant into symbol table.

Parameters:
name - The constant's name.
type - The constant's type.

enterBinop

private void enterBinop(java.lang.String name,
                        Type left,
                        Type right,
                        Type res,
                        int opcode)
Enter a binary operation into symbol table.

Parameters:
name - The name of the operator.
left - The type of the left operand.
right - The type of the left operand.
res - The operation's result type.
opcode - The operation's bytecode instruction.

enterBinop

private void enterBinop(java.lang.String name,
                        Type left,
                        Type right,
                        Type res,
                        int opcode1,
                        int opcode2)
Enter a binary operation, as above but with two opcodes, which get encoded as (opcode1 << ByteCodeTags.preShift) + opcode2.

Parameters:
opcode1 - First opcode.
opcode2 - Second opcode.

enterUnop

private Symbol.OperatorSymbol enterUnop(java.lang.String name,
                                        Type arg,
                                        Type res,
                                        int opcode)
Enter a unary operation into symbol table.

Parameters:
name - The name of the operator.
arg - The type of the operand.
res - The operation's result type.
opcode - The operation's bytecode instruction.

enterClass

private Type enterClass(java.lang.String s)
Enter a class into symbol table.

Parameters:
The - name of the class.

synthesizeEmptyInterfaceIfMissing

public void synthesizeEmptyInterfaceIfMissing(Type type)

synthesizeBoxTypeIfMissing

public void synthesizeBoxTypeIfMissing(Type type)