edu.rice.cs.javalanglevels
Class IntermediateVisitor
java.lang.Object
edu.rice.cs.javalanglevels.JExpressionIFPrunableDepthFirstVisitor
edu.rice.cs.javalanglevels.LanguageLevelVisitor
edu.rice.cs.javalanglevels.IntermediateVisitor
- All Implemented Interfaces:
- JExpressionIFVisitor<Void>
- Direct Known Subclasses:
- BodyBodyIntermediateVisitor, ClassBodyIntermediateVisitor, InterfaceBodyIntermediateVisitor
public class IntermediateVisitor
- extends LanguageLevelVisitor
Top-level Language Level Visitor that represents the Intermediate Language Level. Enforces constraints during the
first walk of the AST (checking for langauge specific errors and building the symbol table).
This class enforces things that are common to all contexts reachable at the Intermediate Language Level
(i.e., inside class bodies, method bodies, interface bodies, etc), but also enforces specific top level
constraints (i.e. you cannot have try catch statements at the top level, etc.)
|
Constructor Summary |
IntermediateVisitor(File file)
This constructor is called when testing. |
IntermediateVisitor(File file,
LinkedList<Pair<String,JExpressionIF>> errors,
Hashtable<String,Triple<SourceInfo,LanguageLevelVisitor,SymbolData>> continuations,
LinkedList<Command> fixUps,
LinkedList<Pair<LanguageLevelVisitor,SourceFile>> visitedFiles)
This constructor is called from LanguageLevelVisitor and LanguageLevelConverter when they are instantiating a new
IntermediateVisitor to visit a new file with. |
IntermediateVisitor(File file,
LinkedList<String> importedPackages,
LinkedList<Pair<String,JExpressionIF>> errors,
Hashtable<String,Triple<SourceInfo,LanguageLevelVisitor,SymbolData>> continuations,
LinkedList<Command> fixUps,
LinkedList<Pair<LanguageLevelVisitor,SourceFile>> visitedFiles)
This constructor is called from LanguageLevelVisitor and LanguageLevelConverter when they are instantiating a new
IntermediateVisitor to visit a new file with. |
IntermediateVisitor(File file,
String packageName,
String enclosingClassName,
LinkedList<String> importedFiles,
LinkedList<String> importedPackages,
HashSet<String> classesInThisFile,
Hashtable<String,Triple<SourceInfo,LanguageLevelVisitor,SymbolData>> continuations,
LinkedList<Command> fixUps)
This constructor is called when creating a new instance of IntermediateVisitor. |
|
Method Summary |
void |
complexAnonymousClassInstantiationHelper(ComplexAnonymousClassInstantiation that,
SymbolData enclosing)
Do not resolve the super class type of this instantiation, because it will have already been resolved (it is an
inner class of the enclosing SD. |
Void |
forBitwiseAndExpressionDoFirst(BitwiseAndExpression that)
|
Void |
forBitwiseAssignmentExpressionDoFirst(BitwiseAssignmentExpression that)
|
Void |
forBitwiseBinaryExpressionDoFirst(BitwiseBinaryExpression that)
|
Void |
forBitwiseNotExpressionDoFirst(BitwiseNotExpression that)
|
Void |
forBitwiseNotExpressionDoFirst(ShiftBinaryExpression that)
|
Void |
forBitwiseOrExpressionDoFirst(BitwiseOrExpression that)
|
Void |
forBitwiseXorExpressionDoFirst(BitwiseXorExpression that)
|
Void |
forClassDef(ClassDef that)
Use the doFirst method to make sure there aren't any errors with the declaration. |
Void |
forInterfaceDef(InterfaceDef that)
Use the doFirst method to make sure that there aren't any errors with the declaration. |
Void |
forModifiersAndVisibilityDoFirst(ModifiersAndVisibility that)
Only abstract, public, private, protected, static and final are allowed in language levels. |
Void |
forShiftAssignmentExpressionDoFirst(ShiftAssignmentExpression that)
Bitwise operators are not allowed at any language level... |
Void |
forShiftBinaryExpressionDoFirst(ShiftBinaryExpression that)
|
Void |
forSynchronizedStatementDoFirst(SynchronizedStatement that)
Do not allow synchronized statements at the Intermediate Level. |
Void |
forTypeParameterDoFirst(TypeParameter that)
Do not allow type parameters (generics) at the Intermediate level |
protected void |
handleInnerClassDef(InnerClassDef that,
Data enclosing,
String relName,
String name)
Check to make sure the inner class def is well-formed, resolve it, and store the resulting symbol in the outer
class's list of inner classes. |
protected void |
handleInnerInterfaceDef(InnerInterfaceDef that,
Data enclosing,
String relName,
String name)
Confirms that the inner interface is well-formed, resolves it, and stores it in the outer class's list of inner
classes. |
protected VariableData[] |
llVariableDeclaration2VariableData(VariableDeclaration vd,
Data enclosingData)
Pass this call directly onto the language level visitor. |
LanguageLevelVisitor |
newClassBodyVisitor(SymbolData anonSD,
String anonName)
Factory method inherited from LLV class. |
void |
simpleAnonymousClassInstantiationHelper(SimpleAnonymousClassInstantiation that,
SymbolData enclosing)
Look up the supertype of this class instantiation and add it to the symbol table. |
| Methods inherited from class edu.rice.cs.javalanglevels.LanguageLevelVisitor |
_addAndIgnoreError, _addError, _badModifiers, _checkError, _getSymbolDataFromFileSystem, _identifyType, _lookupTypeFromWithinClass, _resetNonStaticFields, _variableDeclaration2VariableData, addGeneratedMethod, addInnerSymbolData, anonymousClassInstantiationHelper, arrayEquals, createAccessors, createConstructor, createEquals, createHashCode, createImportedSymbolContinuation, createMethodData, createToString, defineAnonymousSymbolData, defineArraySymbolData, defineInnerSymbolData, defineSymbolData, defineSymbolData, forAbstractMethodDefDoFirst, forClassDefDoFirst, forClassImportStatementOnly, forComplexNameReference, forConcreteMethodDefDoFirst, forEmptyExpressionDoFirst, forInnerInterfaceDefDoFirst, forInterfaceDefDoFirst, formalParameters2VariableData, forMemberType, forNoOpExpressionDoFirst, forPackageImportStatementOnly, forPackageStatementOnly, forSimpleNamedClassInstantiation, forSimpleNameReference, forSourceFile, forSourceFileDoFirst, forStringLiteralOnly, forVariableDeclaration, getFieldAccessorName, getFile, getFormalParameterMav, getQualifiedClassName, getQualifiedClassName, getQualifiedSymbolData, getQualifiedSymbolData, getQualifiedSymbolData, getQualifiedSymbolData, getSymbolData, getSymbolData, getSymbolData, getSymbolData, getSymbolData, getUnqualifiedClassName, identifyInnerClasses, isConstructor, isDuplicateVariableData, isJavaLibraryClass, makeContinuation, prune, referenceType2String, resolveSymbol |
| Methods inherited from class edu.rice.cs.javalanglevels.JExpressionIFPrunableDepthFirstVisitor |
defaultCase, defaultDoFirst, forAbstractMethodDef, forAbstractMethodDefOnly, forAndExpression, forAndExpressionDoFirst, forAndExpressionOnly, forAnonymousClassInstantiationDoFirst, forAnonymousClassInstantiationOnly, forArrayAccess, forArrayAccessDoFirst, forArrayAccessOnly, forArrayInitializer, forArrayInitializerDoFirst, forArrayInitializerOnly, forArrayInstantiationDoFirst, forArrayInstantiationOnly, forArrayType, forArrayTypeDoFirst, forArrayTypeOnly, forAssignmentExpressionDoFirst, forAssignmentExpressionOnly, forBinaryExpressionDoFirst, forBinaryExpressionOnly, forBitwiseAndAssignmentExpression, forBitwiseAndAssignmentExpressionDoFirst, forBitwiseAndAssignmentExpressionOnly, forBitwiseAndExpression, forBitwiseAndExpressionOnly, forBitwiseAssignmentExpressionOnly, forBitwiseBinaryExpressionOnly, forBitwiseNotExpression, forBitwiseNotExpressionOnly, forBitwiseOrAssignmentExpression, forBitwiseOrAssignmentExpressionDoFirst, forBitwiseOrAssignmentExpressionOnly, forBitwiseOrExpression, forBitwiseOrExpressionOnly, forBitwiseXorAssignmentExpression, forBitwiseXorAssignmentExpressionDoFirst, forBitwiseXorAssignmentExpressionOnly, forBitwiseXorExpression, forBitwiseXorExpressionOnly, forBlock, forBlockDoFirst, forBlockOnly, forBodyDoFirst, forBodyOnly, forBooleanExpressionDoFirst, forBooleanExpressionOnly, forBooleanLiteral, forBooleanLiteralDoFirst, forBooleanLiteralOnly, forBracedBody, forBracedBodyDoFirst, forBracedBodyOnly, forBreakStatementDoFirst, forBreakStatementOnly, forCastExpression, forCastExpressionDoFirst, forCastExpressionOnly, forCatchBlock, forCatchBlockDoFirst, forCatchBlockOnly, forCharLiteral, forCharLiteralDoFirst, forCharLiteralOnly, forClassDefOnly, forClassImportStatement, forClassImportStatementDoFirst, forClassInstantiationDoFirst, forClassInstantiationOnly, forClassLiteral, forClassLiteralDoFirst, forClassLiteralOnly, forClassOrInterfaceType, forClassOrInterfaceTypeDoFirst, forClassOrInterfaceTypeOnly, forComparisonExpressionDoFirst, forComparisonExpressionOnly, forComplexAnonymousClassInstantiation, forComplexAnonymousClassInstantiationDoFirst, forComplexAnonymousClassInstantiationOnly, forComplexInitializedArrayInstantiation, forComplexInitializedArrayInstantiationDoFirst, forComplexInitializedArrayInstantiationOnly, forComplexMethodInvocation, forComplexMethodInvocationDoFirst, forComplexMethodInvocationOnly, forComplexNamedClassInstantiation, forComplexNamedClassInstantiationDoFirst, forComplexNamedClassInstantiationOnly, forComplexNameReferenceDoFirst, forComplexNameReferenceOnly, forComplexSuperConstructorInvocation, forComplexSuperConstructorInvocationDoFirst, forComplexSuperConstructorInvocationOnly, forComplexSuperReference, forComplexSuperReferenceDoFirst, forComplexSuperReferenceOnly, forComplexThisConstructorInvocation, forComplexThisConstructorInvocationDoFirst, forComplexThisConstructorInvocationOnly, forComplexThisReference, forComplexThisReferenceDoFirst, forComplexThisReferenceOnly, forComplexUninitializedArrayInstantiation, forComplexUninitializedArrayInstantiationDoFirst, forComplexUninitializedArrayInstantiationOnly, forCompoundWord, forCompoundWordDoFirst, forCompoundWordOnly, forConcreteMethodDef, forConcreteMethodDefOnly, forConditionalExpression, forConditionalExpressionDoFirst, forConditionalExpressionOnly, forConstructorDef, forConstructorDefDoFirst, forConstructorDefOnly, forContinueStatementDoFirst, forContinueStatementOnly, forDefaultCase, forDefaultCaseDoFirst, forDefaultCaseOnly, forDimensionExpressionList, forDimensionExpressionListDoFirst, forDimensionExpressionListOnly, forDivideAssignmentExpression, forDivideAssignmentExpressionDoFirst, forDivideAssignmentExpressionOnly, forDivideExpression, forDivideExpressionDoFirst, forDivideExpressionOnly, forDoStatement, forDoStatementDoFirst, forDoStatementOnly, forDoubleLiteral, forDoubleLiteralDoFirst, forDoubleLiteralOnly, forEmptyExpression, forEmptyExpressionOnly, forEmptyForCondition, forEmptyForConditionDoFirst, forEmptyForConditionOnly, forEmptyStatement, forEmptyStatementDoFirst, forEmptyStatementOnly, forEqualityExpressionDoFirst, forEqualityExpressionOnly, forEqualsExpression, forEqualsExpressionDoFirst, forEqualsExpressionOnly, forExpressionDoFirst, forExpressionListDoFirst, forExpressionListOnly, forExpressionOnly, forExpressionStatement, forExpressionStatementDoFirst, forExpressionStatementOnly, forFloatLiteral, forFloatLiteralDoFirst, forFloatLiteralOnly, forFormalParameter, forFormalParameterDoFirst, forFormalParameterOnly, forForStatement, forForStatementDoFirst, forForStatementOnly, forFunctionInvocationDoFirst, forFunctionInvocationOnly, forGreaterThanExpression, forGreaterThanExpressionDoFirst, forGreaterThanExpressionOnly, forGreaterThanOrEqualExpression, forGreaterThanOrEqualExpressionDoFirst, forGreaterThanOrEqualExpressionOnly, forIfThenElseStatement, forIfThenElseStatementDoFirst, forIfThenElseStatementOnly, forIfThenStatement, forIfThenStatementDoFirst, forIfThenStatementOnly, forImportStatementDoFirst, forImportStatementOnly, forIncrementExpressionDoFirst, forIncrementExpressionOnly, forInitializedArrayInstantiationDoFirst, forInitializedArrayInstantiationOnly, forInitializedVariableDeclarator, forInitializedVariableDeclaratorDoFirst, forInitializedVariableDeclaratorOnly, forInitializerDoFirst, forInitializerOnly, forInnerClassDef, forInnerClassDefDoFirst, forInnerClassDefOnly, forInnerInterfaceDef, forInnerInterfaceDefOnly, forInstanceInitializer, forInstanceInitializerDoFirst, forInstanceInitializerOnly, forInstanceofExpression, forInstanceofExpressionDoFirst, forInstanceofExpressionOnly, forInstantiationDoFirst, forInstantiationOnly, forIntegerLiteral, forIntegerLiteralDoFirst, forIntegerLiteralOnly, forInterfaceDefOnly, forJExpressionDoFirst, forJExpressionOnly, forLabeledBreakStatement, forLabeledBreakStatementDoFirst, forLabeledBreakStatementOnly, forLabeledCase, forLabeledCaseDoFirst, forLabeledCaseOnly, forLabeledContinueStatement, forLabeledContinueStatementDoFirst, forLabeledContinueStatementOnly, forLabeledStatement, forLabeledStatementDoFirst, forLabeledStatementOnly, forLeftShiftAssignmentExpression, forLeftShiftAssignmentExpressionDoFirst, forLeftShiftAssignmentExpressionOnly, forLeftShiftExpression, forLeftShiftExpressionDoFirst, forLeftShiftExpressionOnly, forLessThanExpression, forLessThanExpressionDoFirst, forLessThanExpressionOnly, forLessThanOrEqualExpression, forLessThanOrEqualExpressionDoFirst, forLessThanOrEqualExpressionOnly, forLexicalLiteralDoFirst, forLexicalLiteralOnly, forLongLiteral, forLongLiteralDoFirst, forLongLiteralOnly, forMemberTypeDoFirst, forMemberTypeOnly, forMethodDefDoFirst, forMethodDefOnly, forMethodInvocationDoFirst, forMethodInvocationOnly, forMinusAssignmentExpression, forMinusAssignmentExpressionDoFirst, forMinusAssignmentExpressionOnly, forMinusExpression, forMinusExpressionDoFirst, forMinusExpressionOnly, forModAssignmentExpression, forModAssignmentExpressionDoFirst, forModAssignmentExpressionOnly, forModExpression, forModExpressionDoFirst, forModExpressionOnly, forModifiersAndVisibility, forModifiersAndVisibilityOnly, forMultiplyAssignmentExpression, forMultiplyAssignmentExpressionDoFirst, forMultiplyAssignmentExpressionOnly, forMultiplyExpression, forMultiplyExpressionDoFirst, forMultiplyExpressionOnly, forNamedClassInstantiationDoFirst, forNamedClassInstantiationOnly, forNameReferenceDoFirst, forNameReferenceOnly, forNegativeExpression, forNegativeExpressionDoFirst, forNegativeExpressionOnly, forNegativePostfixIncrementExpression, forNegativePostfixIncrementExpressionDoFirst, forNegativePostfixIncrementExpressionOnly, forNegativePrefixIncrementExpression, forNegativePrefixIncrementExpressionDoFirst, forNegativePrefixIncrementExpressionOnly, forNoOpExpression, forNoOpExpressionOnly, forNormalTryCatchStatement, forNormalTryCatchStatementDoFirst, forNormalTryCatchStatementOnly, forNotEqualExpression, forNotEqualExpressionDoFirst, forNotEqualExpressionOnly, forNotExpression, forNotExpressionDoFirst, forNotExpressionOnly, forNullLiteral, forNullLiteralDoFirst, forNullLiteralOnly, forNumericAssignmentExpressionDoFirst, forNumericAssignmentExpressionOnly, forNumericBinaryExpressionDoFirst, forNumericBinaryExpressionOnly, forNumericUnaryExpressionDoFirst, forNumericUnaryExpressionOnly, forOrExpression, forOrExpressionDoFirst, forOrExpressionOnly, forPackageImportStatement, forPackageImportStatementDoFirst, forPackageStatement, forPackageStatementDoFirst, forParenthesized, forParenthesizedDoFirst, forParenthesizedExpressionList, forParenthesizedExpressionListDoFirst, forParenthesizedExpressionListOnly, forParenthesizedOnly, forPlusAssignmentExpression, forPlusAssignmentExpressionDoFirst, forPlusAssignmentExpressionOnly, forPlusExpression, forPlusExpressionDoFirst, forPlusExpressionOnly, forPositiveExpression, forPositiveExpressionDoFirst, forPositiveExpressionOnly, forPositivePostfixIncrementExpression, forPositivePostfixIncrementExpressionDoFirst, forPositivePostfixIncrementExpressionOnly, forPositivePrefixIncrementExpression, forPositivePrefixIncrementExpressionDoFirst, forPositivePrefixIncrementExpressionOnly, forPostfixIncrementExpressionDoFirst, forPostfixIncrementExpressionOnly, forPrefixIncrementExpressionDoFirst, forPrefixIncrementExpressionOnly, forPrimaryDoFirst, forPrimaryOnly, forPrimitiveType, forPrimitiveTypeDoFirst, forPrimitiveTypeOnly, forReferenceTypeDoFirst, forReferenceTypeOnly, forReturnStatementDoFirst, forReturnStatementOnly, forRightSignedShiftAssignmentExpression, forRightSignedShiftAssignmentExpressionDoFirst, forRightSignedShiftAssignmentExpressionOnly, forRightSignedShiftExpression, forRightSignedShiftExpressionDoFirst, forRightSignedShiftExpressionOnly, forRightUnsignedShiftAssignmentExpression, forRightUnsignedShiftAssignmentExpressionDoFirst, forRightUnsignedShiftAssignmentExpressionOnly, forRightUnsignedShiftExpression, forRightUnsignedShiftExpressionDoFirst, forRightUnsignedShiftExpressionOnly, forShiftAssignmentExpressionOnly, forShiftBinaryExpressionOnly, forSimpleAnonymousClassInstantiation, forSimpleAnonymousClassInstantiationDoFirst, forSimpleAnonymousClassInstantiationOnly, forSimpleAssignmentExpression, forSimpleAssignmentExpressionDoFirst, forSimpleAssignmentExpressionOnly, forSimpleInitializedArrayInstantiation, forSimpleInitializedArrayInstantiationDoFirst, forSimpleInitializedArrayInstantiationOnly, forSimpleMethodInvocation, forSimpleMethodInvocationDoFirst, forSimpleMethodInvocationOnly, forSimpleNamedClassInstantiationDoFirst, forSimpleNamedClassInstantiationOnly, forSimpleNameReferenceDoFirst, forSimpleNameReferenceOnly, forSimpleSuperConstructorInvocation, forSimpleSuperConstructorInvocationDoFirst, forSimpleSuperConstructorInvocationOnly, forSimpleSuperReference, forSimpleSuperReferenceDoFirst, forSimpleSuperReferenceOnly, forSimpleThisConstructorInvocation, forSimpleThisConstructorInvocationDoFirst, forSimpleThisConstructorInvocationOnly, forSimpleThisReference, forSimpleThisReferenceDoFirst, forSimpleThisReferenceOnly, forSimpleUninitializedArrayInstantiation, forSimpleUninitializedArrayInstantiationDoFirst, forSimpleUninitializedArrayInstantiationOnly, forSourceFileOnly, forStatementDoFirst, forStatementOnly, forStaticInitializer, forStaticInitializerDoFirst, forStaticInitializerOnly, forStringLiteral, forStringLiteralDoFirst, forSuperConstructorInvocationDoFirst, forSuperConstructorInvocationOnly, forSuperReferenceDoFirst, forSuperReferenceOnly, forSwitchCaseDoFirst, forSwitchCaseOnly, forSwitchStatement, forSwitchStatementDoFirst, forSwitchStatementOnly, forSynchronizedStatement, forSynchronizedStatementOnly, forThisConstructorInvocationDoFirst, forThisConstructorInvocationOnly, forThisReferenceDoFirst, forThisReferenceOnly, forThrowStatement, forThrowStatementDoFirst, forThrowStatementOnly, forTryCatchFinallyStatement, forTryCatchFinallyStatementDoFirst, forTryCatchFinallyStatementOnly, forTryCatchStatementDoFirst, forTryCatchStatementOnly, forTypeDefBaseDoFirst, forTypeDefBaseOnly, forTypeDoFirst, forTypeOnly, forTypeParameter, forTypeParameterOnly, forTypeVariable, forTypeVariableDoFirst, forTypeVariableOnly, forUnaryExpressionDoFirst, forUnaryExpressionOnly, forUnbracedBody, forUnbracedBodyDoFirst, forUnbracedBodyOnly, forUninitializedArrayInstantiationDoFirst, forUninitializedArrayInstantiationOnly, forUninitializedVariableDeclarator, forUninitializedVariableDeclaratorDoFirst, forUninitializedVariableDeclaratorOnly, forUnlabeledBreakStatement, forUnlabeledBreakStatementDoFirst, forUnlabeledBreakStatementOnly, forUnlabeledContinueStatement, forUnlabeledContinueStatementDoFirst, forUnlabeledContinueStatementOnly, forUnparenthesizedExpressionList, forUnparenthesizedExpressionListDoFirst, forUnparenthesizedExpressionListOnly, forValueReturnStatement, forValueReturnStatementDoFirst, forValueReturnStatementOnly, forVariableDeclarationDoFirst, forVariableDeclarationOnly, forVariableDeclaratorDoFirst, forVariableDeclaratorOnly, forVariableReferenceDoFirst, forVariableReferenceOnly, forVoidReturn, forVoidReturnDoFirst, forVoidReturnOnly, forVoidReturnStatement, forVoidReturnStatementDoFirst, forVoidReturnStatementOnly, forWhileStatement, forWhileStatementDoFirst, forWhileStatementOnly, forWord, forWordDoFirst, forWordOnly |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IntermediateVisitor
public IntermediateVisitor(File file,
String packageName,
String enclosingClassName,
LinkedList<String> importedFiles,
LinkedList<String> importedPackages,
HashSet<String> classesInThisFile,
Hashtable<String,Triple<SourceInfo,LanguageLevelVisitor,SymbolData>> continuations,
LinkedList<Command> fixUps)
- This constructor is called when creating a new instance of IntermediateVisitor. The default value for className
is the empty string. The default value of _genericTypes (a field of LanguageLevelVisitor) is an empty HashMap.
IntermediateVisitor
public IntermediateVisitor(File file)
- This constructor is called when testing. It initializes all of the static fields of LanguageLevelVisitor.
IntermediateVisitor
public IntermediateVisitor(File file,
LinkedList<Pair<String,JExpressionIF>> errors,
Hashtable<String,Triple<SourceInfo,LanguageLevelVisitor,SymbolData>> continuations,
LinkedList<Command> fixUps,
LinkedList<Pair<LanguageLevelVisitor,SourceFile>> visitedFiles)
- This constructor is called from LanguageLevelVisitor and LanguageLevelConverter when they are instantiating a new
IntermediateVisitor to visit a new file with. _package is set to "" by default. _enclosingClassName is set to null
- Parameters:
file - The File corresponding to the source file we are visitingerrors - The list of errors that have been encountered so far.continuations - The table of classes we have encountered but still need to resolvefixUps - This list of symbolTable fixups to perform after visitationvisitedFiles - The list of files we have visited
IntermediateVisitor
public IntermediateVisitor(File file,
LinkedList<String> importedPackages,
LinkedList<Pair<String,JExpressionIF>> errors,
Hashtable<String,Triple<SourceInfo,LanguageLevelVisitor,SymbolData>> continuations,
LinkedList<Command> fixUps,
LinkedList<Pair<LanguageLevelVisitor,SourceFile>> visitedFiles)
- This constructor is called from LanguageLevelVisitor and LanguageLevelConverter when they are instantiating a new
IntermediateVisitor to visit a new file with. _package is set to "" by default. _enclosingClassName is set to null
- Parameters:
file - The File corresponding to the source file we are visitingimportedPackages - The list of strings describing the imported packages for this fileerrors - The list of errors that have been encountered so far.continuations - The table of classes we have encountered but still need to resolvefixUps - This list of symbolTable fixups to perform after visitationvisitedFiles - The list of files we have visited
newClassBodyVisitor
public LanguageLevelVisitor newClassBodyVisitor(SymbolData anonSD,
String anonName)
- Factory method inherited from LLV class.
- Overrides:
newClassBodyVisitor in class LanguageLevelVisitor
handleInnerClassDef
protected void handleInnerClassDef(InnerClassDef that,
Data enclosing,
String relName,
String name)
- Check to make sure the inner class def is well-formed, resolve it, and store the resulting symbol in the outer
class's list of inner classes. This method is used in InterfaceBodyIntermediateVisitor but needs the correct
Data so we pass it in. This method is tested in those files. We use the fully qualified name so that we
don't accidentally conflict with another class in the symbol table.
- Parameters:
that - AST Node for the inner class defenclosing - Data that encloses this inner class; the inner class can be in a class or a method.relName - The relative name of the inner class including no qualifiersname - Fully qualified name of the inner class. For a local class, we construct the same name as the Java
compiler, which inserts "$" as the delimiter preceding the raw class name. For example, if class A
has a method B with a local class C, then qualified name for this class is "A$1C", provided the class is the
first local class (including anonymous classes) in the enclosing class.
handleInnerInterfaceDef
protected void handleInnerInterfaceDef(InnerInterfaceDef that,
Data enclosing,
String relName,
String name)
- Confirms that the inner interface is well-formed, resolves it, and stores it in the outer class's list of inner
classes. This method is common to both ClassBodyIntermediateVisitor and InterfaceBodyIntermediateVisitor but
needs the correct SymbolData so we pass it in. This method is tested in those files.
- Parameters:
that - AST Node for the inner class defenclosing - Data that encloses this inner class; the inner class can be in a class or a method.name - Fully qualified name of the inner class. For a local class, we construct the same name as the Java
compiler (??), which inserts "$" as the delimiter preceding the raw class name. For example, if class A
has a method B with a local class C, then qualified name for this class is "A$1C", provided the class is the
first local class (including anonymous classes) in the enclosing class.
forModifiersAndVisibilityDoFirst
public Void forModifiersAndVisibilityDoFirst(ModifiersAndVisibility that)
- Only abstract, public, private, protected, static and final are allowed in language levels.
- Overrides:
forModifiersAndVisibilityDoFirst in class LanguageLevelVisitor
forSynchronizedStatementDoFirst
public Void forSynchronizedStatementDoFirst(SynchronizedStatement that)
- Do not allow synchronized statements at the Intermediate Level.
- Overrides:
forSynchronizedStatementDoFirst in class JExpressionIFPrunableDepthFirstVisitor
forTypeParameterDoFirst
public Void forTypeParameterDoFirst(TypeParameter that)
- Do not allow type parameters (generics) at the Intermediate level
- Overrides:
forTypeParameterDoFirst in class JExpressionIFPrunableDepthFirstVisitor
forClassDef
public Void forClassDef(ClassDef that)
- Use the doFirst method to make sure there aren't any errors with the declaration. Then, use defineSymbolData to
create the appropriate SymbolData, and then visit the class body. Finally, autogenerate the toString, equals,
hashCode, and accessor methods. The constructor will be autogenerated right before the TypeChecking pass starts.
Once the class def has been handled, remove it from _classesInThisFile.
- Specified by:
forClassDef in interface JExpressionIFVisitor<Void>- Overrides:
forClassDef in class JExpressionIFPrunableDepthFirstVisitor
forInterfaceDef
public Void forInterfaceDef(InterfaceDef that)
- Use the doFirst method to make sure that there aren't any errors with the declaration. Define a SymbolData
corresponding to this interface definition. Then visit the body to handle anything defined inside the interfac
Once the interface has been resolved, remove it from _classesInThisFile.
- Specified by:
forInterfaceDef in interface JExpressionIFVisitor<Void>- Overrides:
forInterfaceDef in class JExpressionIFPrunableDepthFirstVisitor
forShiftAssignmentExpressionDoFirst
public Void forShiftAssignmentExpressionDoFirst(ShiftAssignmentExpression that)
- Bitwise operators are not allowed at any language level...
- Overrides:
forShiftAssignmentExpressionDoFirst in class LanguageLevelVisitor
forBitwiseAssignmentExpressionDoFirst
public Void forBitwiseAssignmentExpressionDoFirst(BitwiseAssignmentExpression that)
- Overrides:
forBitwiseAssignmentExpressionDoFirst in class LanguageLevelVisitor
forBitwiseBinaryExpressionDoFirst
public Void forBitwiseBinaryExpressionDoFirst(BitwiseBinaryExpression that)
- Overrides:
forBitwiseBinaryExpressionDoFirst in class LanguageLevelVisitor
forBitwiseOrExpressionDoFirst
public Void forBitwiseOrExpressionDoFirst(BitwiseOrExpression that)
- Overrides:
forBitwiseOrExpressionDoFirst in class LanguageLevelVisitor
forBitwiseXorExpressionDoFirst
public Void forBitwiseXorExpressionDoFirst(BitwiseXorExpression that)
- Overrides:
forBitwiseXorExpressionDoFirst in class LanguageLevelVisitor
forBitwiseAndExpressionDoFirst
public Void forBitwiseAndExpressionDoFirst(BitwiseAndExpression that)
- Overrides:
forBitwiseAndExpressionDoFirst in class LanguageLevelVisitor
forBitwiseNotExpressionDoFirst
public Void forBitwiseNotExpressionDoFirst(BitwiseNotExpression that)
- Overrides:
forBitwiseNotExpressionDoFirst in class LanguageLevelVisitor
forShiftBinaryExpressionDoFirst
public Void forShiftBinaryExpressionDoFirst(ShiftBinaryExpression that)
- Overrides:
forShiftBinaryExpressionDoFirst in class LanguageLevelVisitor
forBitwiseNotExpressionDoFirst
public Void forBitwiseNotExpressionDoFirst(ShiftBinaryExpression that)
- Overrides:
forBitwiseNotExpressionDoFirst in class LanguageLevelVisitor
llVariableDeclaration2VariableData
protected VariableData[] llVariableDeclaration2VariableData(VariableDeclaration vd,
Data enclosingData)
- Pass this call directly onto the language level visitor. This is a hack to bypass the privateAndFinal setting
when we are dealing with local variables.
simpleAnonymousClassInstantiationHelper
public void simpleAnonymousClassInstantiationHelper(SimpleAnonymousClassInstantiation that,
SymbolData enclosing)
- Look up the supertype of this class instantiation and add it to the symbol table. Visit the body of the class
instantiation. The processing of this anonymous inner class (i.e. adding it to the enclosing SD's list of inner
classes, creating a SymbolData for the anonyomous inner class, etc) will be handled in the TypeChecker pass.
This is because no one will depend on that symbolData until we create it.
- Parameters:
that - The SimpleAnonymousClassInstantiation being processed.enclosing - The SymbolData of the enclosing class.
complexAnonymousClassInstantiationHelper
public void complexAnonymousClassInstantiationHelper(ComplexAnonymousClassInstantiation that,
SymbolData enclosing)
- Do not resolve the super class type of this instantiation, because it will have already been resolved (it is an
inner class of the enclosing SD. When the enclosing SD was resolved, all of its inner classes
should have also been resolved). Visit the body of the class instantiation.
- Parameters:
that - The ComplexAnonymousClassInstantiation being processed.enclosing - The SymbolData of the enclosing class.