|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.javalanglevels.Data
edu.rice.cs.javalanglevels.TypeData
edu.rice.cs.javalanglevels.SymbolData
public class SymbolData
Represents the data for a given class. There are two states of SymbolData. One is a continuation which is created when a type is referenced, but the corresponding class has not been read for its members. The other is a complete SymbolData containing all of the member data.
Nested Class Summary | |
---|---|
static class |
SymbolData.SymbolDataTest
Test the methods defined in the above class |
Nested classes/interfaces inherited from class edu.rice.cs.javalanglevels.Data |
---|
Data.DataTest |
Field Summary | |
---|---|
static SymbolData |
AMBIGUOUS_REFERENCE
Used when 2 or more SymbolDatas could match |
static SymbolData |
BOOLEAN_TYPE
This anonymous class represents the boolean primitive type |
static SymbolData |
BYTE_TYPE
This anonymous class represents the byte primitive type |
static SymbolData |
CHAR_TYPE
This anonymous class represents the char primitive type. |
static SymbolData |
DOUBLE_TYPE
This represents the double primitive |
static SymbolData |
EXCEPTION
Used for an exception |
static SymbolData |
FLOAT_TYPE
This represents the float primitive |
static SymbolData |
INT_TYPE
This anonymous class represents the int primitive type. |
static SymbolData |
LONG_TYPE
This represents the long primitive |
static SymbolData |
NOT_FOUND
Used to signal a symbol table search that failed. |
static SymbolData |
NULL_TYPE
Singleton class representing null |
static SymbolData |
SHORT_TYPE
This anonymous class represents the short primitive type. |
static SymbolData |
SUPER_CONSTRUCTOR
Used when a super constructor invocation is seen. |
static SymbolData |
THIS_CONSTRUCTOR
Used when a this constructor invocation is seen. |
static SymbolData |
VOID_TYPE
Used for the void type. |
Fields inherited from class edu.rice.cs.javalanglevels.Data |
---|
_blockIterator, _blocks, _enclosingData, _innerClasses, _modifiersAndVisibility, _name, _outerData, _vars |
Constructor Summary | |
---|---|
SymbolData(String name)
Creates a continuation symbol for the specified name; does not enter this name in any table. |
|
SymbolData(String name,
ModifiersAndVisibility modifiersAndVisibility,
TypeParameter[] typeParameters,
ArrayList<SymbolData> interfaces,
Data outerData)
This constructor is only called by Interfaces. |
|
SymbolData(String name,
ModifiersAndVisibility modifiersAndVisibility,
TypeParameter[] typeParameters,
SymbolData superClass,
ArrayList<SymbolData> interfaces,
Data outerData)
Constructor for SymbolData |
|
SymbolData(String name,
ModifiersAndVisibility modifiersAndVisibility,
TypeParameter[] typeParameters,
SymbolData superClass,
ArrayList<SymbolData> interfaces,
Data outerData,
String pkg)
Constructor for SymbolData |
|
SymbolData(String name,
SourceInfo si)
Creates a continuation symbol for the specified name and source info; does not enter this name in any table. |
Method Summary | |
---|---|
boolean |
addFinalVars(VariableData[] vars)
Add the array of variable datas to the list of variables defined in this scope, unless a name has already been used. |
void |
addInnerInterface(SymbolData innerInterface)
Add the specified innerInterface to the list of innerInterfaces |
void |
addInterface(SymbolData interphace)
Add an interface to the list of interfaces. |
void |
addMethod(MethodData method)
When adding a method, we must check that the method's signature (name and parameters) does not match that of any other method in the same class. |
void |
addMethod(MethodData method,
boolean isAugmentedCode)
This version of addMethod is called whenever the method corresponds to one that is auto-generated (toString, equals, hashCode, etc.) and is necessary because we need to check if the user defined a method with the same signature and, if so, highlight the user method instead of trying to highlight the auto-generated method (which doesn't appear in the raw version of the source anyway). |
void |
addMethod(MethodData method,
boolean isAugmentedCode,
boolean fromClassFile)
Important to know if this is called from a class file since JSR14 allows methods to have the same name and parameters with different return types for bridge methods. |
boolean |
addVar(VariableData var)
Adds a (perhaps mutable) variable or field to a SymbolData. |
boolean |
addVars(VariableData[] vars)
Adds fields or variables to a SymboLData. |
protected static boolean |
checkDifferentReturnTypes(MethodData md,
SymbolData sd,
boolean addError,
JavaVersion version)
Called to make sure that no method has the same name and parameters as a method it inherits while having different return types. |
protected static boolean |
checkDifferentReturnTypes(MethodData md,
SymbolData sd,
JavaVersion version)
Call checkDifferentReturnTypes with addError set to true by default |
void |
clearSuperClass()
|
String |
createUniqueMethodName(String methodName)
Checks to see if methodName is used in this SymbolData's scope. |
void |
decrementConstructorCount()
Subtract one from the number of constructors for this symbol data |
boolean |
equals(Object obj)
Returns true if the provided Object is equal to this symbol data. |
LinkedList<VariableData> |
getAllSuperVars()
Get all of your vars and all vars that you inherit. |
int |
getAnonymousInnerClassNum()
|
int |
getConstructorCount()
|
protected SymbolData |
getInnerClassOrInterfaceHelper(String nameToMatch,
int firstIndexOfDot)
Takes in a name and tries to match it with one of this Data's inner classes or inner interfaces. |
LinkedList<SymbolData> |
getInnerInterfaces()
|
InstanceData |
getInstanceData()
|
ArrayList<SymbolData> |
getInterfaces()
|
MethodData |
getMethod(String name,
TypeData[] paramTypes)
Returns the method with the given name and param types. |
LinkedList<MethodData> |
getMethods()
|
String |
getPackage()
|
SymbolData |
getSuperClass()
|
SymbolData |
getSymbolData()
Return the enclosing getSymbolData() |
TypeParameter[] |
getTypeParameters()
|
boolean |
hasAutoGeneratedJunitImport()
|
int |
hashCode()
Since SymbolDatas have unique names, in any given symboltable, hash on the name |
boolean |
hasInterface(SymbolData i)
Check to see if the interface i appears anywhere in the hierarchy for this class/interface |
boolean |
hasMethod(String name)
Returns true if there is a method with the given name in this SymbolData. |
boolean |
implementsRunnable()
Check to see if this class is one of the 5 known classes that implement Runnable. |
void |
incrementConstructorCount()
Add one to the number of constructors for this symbol data |
Iterator<SymbolData> |
innerClassesAndInterfacesIterator()
Iterate over first the inner classes and then the inner interfaces. |
boolean |
isAssignableTo(SymbolData assignTo,
JavaVersion version)
See if this can be assigned to assignTo. |
boolean |
isCastableTo(SymbolData castTo,
JavaVersion version)
See if this can be cast as a castTo. |
boolean |
isContinuation()
|
boolean |
isInnerClassOf(SymbolData outerClass,
boolean stopAtStatic)
Checks to see if this SymbolData is an inner class of outerClass (that is, that outerClass appears somewhere in its enclosing data chain. |
boolean |
isInstanceType()
|
boolean |
isInterface()
|
boolean |
isNonFloatOrBooleanType(JavaVersion version)
|
boolean |
isNonFloatOrBooleanTypeWithoutAutoboxing()
|
boolean |
isNumberType(JavaVersion version)
|
boolean |
isNumberTypeWithoutAutoboxing()
|
boolean |
isPrimitiveType()
No reference type is a Primitive type. |
boolean |
isSubClassOf(SymbolData sd)
Depth-first traversal of the tree of enclosing data checking to see if sd is above this SymbolData in the class hierarchy. |
int |
postdecrementAnonymousInnerClassNum()
Return the anonymous inner class num, and then decrement it |
int |
postdecrementLocalClassNum()
Return the local class num, and then decrement it |
int |
preincrementAnonymousInnerClassNum()
Increment the anonymous inner class num, and return it |
int |
preincrementLocalClassNum()
Increment the local class num and return it |
static MethodData |
repeatedSignature(LinkedList<MethodData> listOfMethods,
MethodData method)
Calls repeatedSignature with fromClassFile set to false by default. |
static MethodData |
repeatedSignature(LinkedList<MethodData> listOfMethods,
MethodData method,
boolean fromClassFile)
Checks if two methods in this SymbolData have the same name and parameters. |
SymbolData |
resolve(SourceInfo si,
LanguageLevelVisitor llv)
Resolves this symbol using the visitor llv. |
void |
setAnonymousInnerClassNum(int i)
Set the anonymous inner class num to the specified value |
void |
setHasAutoGeneratedJunitImport(boolean hasAutoGeneratedJunitImport)
Set the isContinuation flag to the specified value |
void |
setInstanceData(InstanceData id)
Sets the InstanceData for this class to the specified value. |
void |
setInterface(boolean ii)
|
void |
setInterfaces(ArrayList<SymbolData> interfaces)
Set the interfaces to be the specified list |
void |
setIsContinuation(boolean isContinuation)
Set the isContinuation flag to the specified value |
void |
setMethods(LinkedList<MethodData> methods)
Sets the list of methods to the specified one |
void |
setPackage(String pkg)
Sets the package to the specified value |
void |
setSuperClass(SymbolData superClass)
Set the super class to the specified value. |
void |
setTypeParameters(TypeParameter[] typeParameters)
Set the generic type parameters to the specified value |
String |
toString()
|
Methods inherited from class edu.rice.cs.javalanglevels.Data |
---|
addBlock, addEnclosingData, addInnerClass, addModifier, createUniqueName, dollarSignsToDots, dotsToDollarSigns, getEnclosingClass, getEnclosingData, getInnerClasses, getInnerClassOrInterface, getMav, getName, getNextAnonymousInnerClass, getNextBlock, getOuterData, getVar, getVars, hasModifier, isAnonymousClass, isDoublyAnonymous, isOuterData, removeAllBlocks, resetBlockIterator, setEnclosingData, setInnerClasses, setMav, setOuterData |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final SymbolData BOOLEAN_TYPE
public static final SymbolData CHAR_TYPE
public static final SymbolData BYTE_TYPE
public static final SymbolData SHORT_TYPE
public static final SymbolData INT_TYPE
public static final SymbolData LONG_TYPE
public static final SymbolData FLOAT_TYPE
public static final SymbolData DOUBLE_TYPE
public static final SymbolData VOID_TYPE
public static final SymbolData EXCEPTION
public static final SymbolData NOT_FOUND
public static final SymbolData NULL_TYPE
public static final SymbolData AMBIGUOUS_REFERENCE
public static final SymbolData THIS_CONSTRUCTOR
public static final SymbolData SUPER_CONSTRUCTOR
Constructor Detail |
---|
public SymbolData(String name, ModifiersAndVisibility modifiersAndVisibility, TypeParameter[] typeParameters, SymbolData superClass, ArrayList<SymbolData> interfaces, Data outerData)
name
- The name of this class or interfacemodifiersAndVisibility
- The modifiersAndVisibility of this class or interfacetypeParameters
- Generic type info, not usedsuperClass
- The super class of this classinterfaces
- The super interfacesouterData
- The enclosing data of this class, or nullpublic SymbolData(String name, ModifiersAndVisibility modifiersAndVisibility, TypeParameter[] typeParameters, SymbolData superClass, ArrayList<SymbolData> interfaces, Data outerData, String pkg)
name
- The name of this class or interfacemodifiersAndVisibility
- The modifiersAndVisibility of this class or interfacetypeParameters
- Generic type info, not usedsuperClass
- The super class of this classinterfaces
- The super interfacesouterData
- The enclosing data of this class, or nullpublic SymbolData(String name, ModifiersAndVisibility modifiersAndVisibility, TypeParameter[] typeParameters, ArrayList<SymbolData> interfaces, Data outerData)
name
- The name of this class or interfacemodifiersAndVisibility
- The modifiersAndVisibility of this class or interfacetypeParameters
- Generic type info, not usedinterfaces
- The super interfacesouterData
- The enclosing data of this class, or nullpublic SymbolData(String name)
public SymbolData(String name, SourceInfo si)
Method Detail |
---|
public boolean isPrimitiveType()
public String toString()
toString
in class Object
public boolean isAssignableTo(SymbolData assignTo, JavaVersion version)
public SymbolData resolve(SourceInfo si, LanguageLevelVisitor llv)
public boolean isCastableTo(SymbolData castTo, JavaVersion version)
castTo
- The TypeData we are trying to cast to. (castTo) this
public boolean isSubClassOf(SymbolData sd)
public boolean isInnerClassOf(SymbolData outerClass, boolean stopAtStatic)
outerClass
- The SymbolData we believe might be our outer class.stopAtStatic
- boolean flag, true if we want to stop at a static outer class.
public boolean isInstanceType()
isInstanceType
in class TypeData
public SymbolData getSymbolData()
Data
getSymbolData
in class TypeData
public InstanceData getInstanceData()
getInstanceData
in class TypeData
public void setInstanceData(InstanceData id)
public String getPackage()
public void setPackage(String pkg)
public TypeParameter[] getTypeParameters()
public void setTypeParameters(TypeParameter[] typeParameters)
public boolean isInterface()
public void setInterface(boolean ii)
public LinkedList<SymbolData> getInnerInterfaces()
protected SymbolData getInnerClassOrInterfaceHelper(String nameToMatch, int firstIndexOfDot)
getInnerClassOrInterfaceHelper
in class Data
public Iterator<SymbolData> innerClassesAndInterfacesIterator()
innerClassesAndInterfacesIterator
in class Data
public void addInnerInterface(SymbolData innerInterface)
public int preincrementLocalClassNum()
public void setAnonymousInnerClassNum(int i)
public int preincrementAnonymousInnerClassNum()
public int getAnonymousInnerClassNum()
public int postdecrementLocalClassNum()
public int postdecrementAnonymousInnerClassNum()
public boolean addVar(VariableData var)
addVar
in class Data
var
- The variable we want to add to this scope.
public boolean addVars(VariableData[] vars)
addVars
in class Data
vars
- The VariableData[] that we want to add.
public boolean addFinalVars(VariableData[] vars)
addFinalVars
in class Data
vars
- The VariableData[] that we want to add.
public LinkedList<MethodData> getMethods()
public boolean hasMethod(String name)
name
- The name of the method to return
public MethodData getMethod(String name, TypeData[] paramTypes)
name
- The name of the method to returnparamTypes
- Array of the TypeDatas correpsonding to the parameters to the method.
public void setMethods(LinkedList<MethodData> methods)
public static MethodData repeatedSignature(LinkedList<MethodData> listOfMethods, MethodData method)
public static MethodData repeatedSignature(LinkedList<MethodData> listOfMethods, MethodData method, boolean fromClassFile)
listOfMethods
- The methods in this SymbolDatamethod
- The MethodData for the method to be addedfromClassFile
- Whether or not a class file is adding this method.
Important because bridge methods, which differ only in return type,
can be added from a class file and are legal but cannot exist in source code.
protected static boolean checkDifferentReturnTypes(MethodData md, SymbolData sd, JavaVersion version)
protected static boolean checkDifferentReturnTypes(MethodData md, SymbolData sd, boolean addError, JavaVersion version)
md
- The MethodData we're currently trying to addsd
- The SymbolData of the class whose enclosingDatas we're examining for
different return types.addError
- true if errors should be added to the type checker
public String createUniqueMethodName(String methodName)
methodName
- The initial String name of the variable we are creating.
public void addMethod(MethodData method)
public void addMethod(MethodData method, boolean isAugmentedCode)
public void addMethod(MethodData method, boolean isAugmentedCode, boolean fromClassFile)
public SymbolData getSuperClass()
public void clearSuperClass()
public void setSuperClass(SymbolData superClass)
public ArrayList<SymbolData> getInterfaces()
public void addInterface(SymbolData interphace)
public void setInterfaces(ArrayList<SymbolData> interfaces)
public void incrementConstructorCount()
public void decrementConstructorCount()
public int getConstructorCount()
public boolean isContinuation()
public void setIsContinuation(boolean isContinuation)
public boolean hasAutoGeneratedJunitImport()
public void setHasAutoGeneratedJunitImport(boolean hasAutoGeneratedJunitImport)
public boolean isNumberTypeWithoutAutoboxing()
public boolean isNumberType(JavaVersion version)
public boolean isNonFloatOrBooleanType(JavaVersion version)
public boolean isNonFloatOrBooleanTypeWithoutAutoboxing()
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public boolean implementsRunnable()
public boolean hasInterface(SymbolData i)
public LinkedList<VariableData> getAllSuperVars()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |