edu.rice.cs.javalanglevels
Class FullJavaVisitor
java.lang.Object
edu.rice.cs.javalanglevels.JExpressionIFPrunableDepthFirstVisitor
edu.rice.cs.javalanglevels.LanguageLevelVisitor
edu.rice.cs.javalanglevels.FullJavaVisitor
- All Implemented Interfaces:
- JExpressionIFVisitor<Void>
- Direct Known Subclasses:
- BodyBodyFullJavaVisitor, ClassBodyFullJavaVisitor, InterfaceBodyFullJavaVisitor
public class FullJavaVisitor
- extends LanguageLevelVisitor
Top-level Language Level Visitor that processes the Full Java Language Level. It constructs a symbol table from a
Java source file if possible. It does not attempt to check for errors since Full Java files are compiled by javac.
|
Constructor Summary |
FullJavaVisitor(File file)
This constructor is called only in testing. |
FullJavaVisitor(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 LanguageLevelConverter when it is instantiating a new
FullJavaVisitor to visit a new file. |
FullJavaVisitor(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 LanguageLevelConverter when it is instantiating a new
FullJavaVisitor to visit a new file. |
FullJavaVisitor(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 from sites where no generic type variables are in scope. |
FullJavaVisitor(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,
HashMap<String,SymbolData> genericTypes)
Main constructor, which is called from sites where the genericTypes table is not empty. |
|
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 of this instantiation. |
void |
createConstructor(SymbolData sd)
At the FullJava Level, there is no code augmentation. |
protected void |
createEquals(SymbolData sd)
This is a noop, because we do not do code augmentation at the Advanced Level. |
protected void |
createHashCode(SymbolData sd)
This is a noop, because we do not do code augmentation at the Advanced Level. |
protected void |
createToString(SymbolData sd)
This is a noop, because we do not do code augmentation at the Advanced Level. |
Void |
forArrayType(ArrayType that)
Process an instance of ArrayType. |
Void |
forClassDef(ClassDef that)
Use the doFirst method to make sure there aren't any errors with the declaration. |
Void |
forConditionalExpressionDoFirst(ConditionalExpression that)
Ignore ConditionalExpression. |
Void |
forInstanceInitializerDoFirst(InstanceInitializer that)
|
Void |
forInstanceofExpressionDoFirst(InstanceofExpression that)
Ignore instanceofExpression. |
Void |
forInterfaceDef(InterfaceDef that)
Create a SymbolData corresponding to this interface and add it appropriately. |
Void |
forLabeledBreakStatementDoFirst(LabeledBreakStatement that)
|
Void |
forLabeledContinueStatementDoFirst(LabeledContinueStatement that)
|
Void |
forLabeledStatementDoFirst(LabeledStatement that)
|
Void |
forModifiersAndVisibilityDoFirst(ModifiersAndVisibility that)
Process ModifiersAndVisibility. |
Void |
forPrimitiveTypeDoFirst(PrimitiveType that)
Process PrimitiveType. |
Void |
forStaticInitializerDoFirst(StaticInitializer that)
|
Void |
forSwitchStatementDoFirst(SwitchStatement that)
Process SwitchStatement. |
Void |
forSynchronizedStatementDoFirst(SynchronizedStatement that)
|
Void |
forTypeParameterDoFirst(TypeParameter that)
Ignore TypeParameter. |
protected String[] |
getFormalParameterMav(Data d)
This overriding is a hack. |
protected void |
handleInnerClassDef(InnerClassDef that,
Data data,
String relName,
String name)
Process the inner class def and then resolve it and store it in
the outer class's list of inner classes. |
protected void |
handleInnerInterfaceDef(InnerInterfaceDef that,
Data data,
String relName,
String name)
Process the inner interface, and resolve it and store it in the
outer class's list of inner classes. |
void |
simpleAnonymousClassInstantiationHelper(SimpleAnonymousClassInstantiation that,
SymbolData enclosing)
Look up the super type 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, createImportedSymbolContinuation, createMethodData, defineAnonymousSymbolData, defineArraySymbolData, defineInnerSymbolData, defineSymbolData, defineSymbolData, forAbstractMethodDefDoFirst, forBitwiseAndExpressionDoFirst, forBitwiseAssignmentExpressionDoFirst, forBitwiseBinaryExpressionDoFirst, forBitwiseNotExpressionDoFirst, forBitwiseNotExpressionDoFirst, forBitwiseOrExpressionDoFirst, forBitwiseXorExpressionDoFirst, forClassDefDoFirst, forClassImportStatementOnly, forComplexNameReference, forConcreteMethodDefDoFirst, forEmptyExpressionDoFirst, forInnerInterfaceDefDoFirst, forInterfaceDefDoFirst, formalParameters2VariableData, forMemberType, forNoOpExpressionDoFirst, forPackageImportStatementOnly, forPackageStatementOnly, forShiftAssignmentExpressionDoFirst, forShiftBinaryExpressionDoFirst, forSimpleNamedClassInstantiation, forSimpleNameReference, forSourceFile, forSourceFileDoFirst, forStringLiteralOnly, forVariableDeclaration, getFieldAccessorName, getFile, getQualifiedClassName, getQualifiedClassName, getQualifiedSymbolData, getQualifiedSymbolData, getQualifiedSymbolData, getQualifiedSymbolData, getSymbolData, getSymbolData, getSymbolData, getSymbolData, getSymbolData, getUnqualifiedClassName, identifyInnerClasses, isConstructor, isDuplicateVariableData, isJavaLibraryClass, makeContinuation, newClassBodyVisitor, 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, 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, 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, forInstanceInitializerOnly, forInstanceofExpression, forInstanceofExpressionOnly, forInstantiationDoFirst, forInstantiationOnly, forIntegerLiteral, forIntegerLiteralDoFirst, forIntegerLiteralOnly, forInterfaceDefOnly, forJExpressionDoFirst, forJExpressionOnly, forLabeledBreakStatement, forLabeledBreakStatementOnly, forLabeledCase, forLabeledCaseDoFirst, forLabeledCaseOnly, forLabeledContinueStatement, forLabeledContinueStatementOnly, forLabeledStatement, 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, 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, forStaticInitializerOnly, forStringLiteral, forStringLiteralDoFirst, forSuperConstructorInvocationDoFirst, forSuperConstructorInvocationOnly, forSuperReferenceDoFirst, forSuperReferenceOnly, forSwitchCaseDoFirst, forSwitchCaseOnly, forSwitchStatement, 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 |
FullJavaVisitor
public FullJavaVisitor(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,
HashMap<String,SymbolData> genericTypes)
- Main constructor, which is called from sites where the genericTypes table is not empty.
FullJavaVisitor
public FullJavaVisitor(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 from sites where no generic type variables are in scope.
FullJavaVisitor
public FullJavaVisitor(File file)
- This constructor is called only in testing. It initializes all of the static fields of LanguageLevelVisitor.
FullJavaVisitor
public FullJavaVisitor(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 LanguageLevelConverter when it is instantiating a new
FullJavaVisitor to visit a new file. Package is set to "" by default. The generic
types table (_genericTypes) is set to an emtpy HashMap by default.
- 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 resolvevisitedFiles - The list of files we have visited
FullJavaVisitor
public FullJavaVisitor(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 LanguageLevelConverter when it is instantiating a new
FullJavaVisitor to visit a new file. Package is set to "" by default.
- 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 resolvevisitedFiles - The list of files we have visited
createConstructor
public void createConstructor(SymbolData sd)
- At the FullJava Level, there is no code augmentation. If we are working with a class that has no constructor,
we must record fact that has an implicit 0-ary default constructor.
- Overrides:
createConstructor in class LanguageLevelVisitor
- Parameters:
sd - The SymbolData we are checking
handleInnerClassDef
protected void handleInnerClassDef(InnerClassDef that,
Data data,
String relName,
String name)
- Process the inner class def and then resolve it and store it in
the outer class's list of inner classes. This method is common to both ClassBodyFullJavaVisitor
and InterfaceBodyIntermediateVisitor but needs the correct Data so we pass it in. This method is tested
in those files. We use the fully qualified name along with the $'s so we don't accidentally conflict with an
actual class in the symbol table.
- Parameters:
that - The AST Node for the inner class defdata - The Data that encloses this inner class. This is a Data because the inner class can be in a class
or a method.relName - The relative name of the inner class including no qualifiersname - The qualified name of the inner class including the qualified name of the enclosing data followed by
a $. For local classes, we append a number after the $ corresponding to the order that the local
class appears in the enclosing class and then put the name of the class. For anonymous classes, we
only put a number after the $. For example, if class A has a method B that has a local class C, then
name should be "A$1C".
handleInnerInterfaceDef
protected void handleInnerInterfaceDef(InnerInterfaceDef that,
Data data,
String relName,
String name)
- Process the inner interface, and resolve it and store 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.
forModifiersAndVisibilityDoFirst
public Void forModifiersAndVisibilityDoFirst(ModifiersAndVisibility that)
- Process ModifiersAndVisibility.
- Overrides:
forModifiersAndVisibilityDoFirst in class LanguageLevelVisitor
forSwitchStatementDoFirst
public Void forSwitchStatementDoFirst(SwitchStatement that)
- Process SwitchStatement.
- Overrides:
forSwitchStatementDoFirst in class JExpressionIFPrunableDepthFirstVisitor
forInstanceInitializerDoFirst
public Void forInstanceInitializerDoFirst(InstanceInitializer that)
- Overrides:
forInstanceInitializerDoFirst in class JExpressionIFPrunableDepthFirstVisitor
forStaticInitializerDoFirst
public Void forStaticInitializerDoFirst(StaticInitializer that)
- Overrides:
forStaticInitializerDoFirst in class JExpressionIFPrunableDepthFirstVisitor
forLabeledStatementDoFirst
public Void forLabeledStatementDoFirst(LabeledStatement that)
- Overrides:
forLabeledStatementDoFirst in class JExpressionIFPrunableDepthFirstVisitor
forLabeledBreakStatementDoFirst
public Void forLabeledBreakStatementDoFirst(LabeledBreakStatement that)
- Overrides:
forLabeledBreakStatementDoFirst in class JExpressionIFPrunableDepthFirstVisitor
forLabeledContinueStatementDoFirst
public Void forLabeledContinueStatementDoFirst(LabeledContinueStatement that)
- Overrides:
forLabeledContinueStatementDoFirst in class JExpressionIFPrunableDepthFirstVisitor
forSynchronizedStatementDoFirst
public Void forSynchronizedStatementDoFirst(SynchronizedStatement that)
- Overrides:
forSynchronizedStatementDoFirst in class JExpressionIFPrunableDepthFirstVisitor
forTypeParameterDoFirst
public Void forTypeParameterDoFirst(TypeParameter that)
- Ignore TypeParameter.
- Overrides:
forTypeParameterDoFirst in class JExpressionIFPrunableDepthFirstVisitor
forConditionalExpressionDoFirst
public Void forConditionalExpressionDoFirst(ConditionalExpression that)
- Ignore ConditionalExpression.
- Overrides:
forConditionalExpressionDoFirst in class JExpressionIFPrunableDepthFirstVisitor
forInstanceofExpressionDoFirst
public Void forInstanceofExpressionDoFirst(InstanceofExpression that)
- Ignore instanceofExpression.
- Overrides:
forInstanceofExpressionDoFirst in class JExpressionIFPrunableDepthFirstVisitor
forPrimitiveTypeDoFirst
public Void forPrimitiveTypeDoFirst(PrimitiveType that)
- Process PrimitiveType.
- Overrides:
forPrimitiveTypeDoFirst in class JExpressionIFPrunableDepthFirstVisitor
getFormalParameterMav
protected String[] getFormalParameterMav(Data d)
- This overriding is a hack. The parameters to a static method can be referenced within the method itself,
even though they are not declared to be static fields. Making them static has no effect on any other processing.
- Overrides:
getFormalParameterMav in class LanguageLevelVisitor
- Returns:
- the formal parameter mav appropriate for the language level; "Functional level" is default.
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 symbol data, and then visit the class body.
Once the ClassDef has been handled, remove the class from _classesInThisFile so we know it's been taken care of.
- Specified by:
forClassDef in interface JExpressionIFVisitor<Void>- Overrides:
forClassDef in class JExpressionIFPrunableDepthFirstVisitor
- Parameters:
that - The ClassDef being handled.
TODO: refactor with same method in IntermediateVisitor; almost identical.
createToString
protected void createToString(SymbolData sd)
- This is a noop, because we do not do code augmentation at the Advanced Level.
- Overrides:
createToString in class LanguageLevelVisitor
createHashCode
protected void createHashCode(SymbolData sd)
- This is a noop, because we do not do code augmentation at the Advanced Level.
- Overrides:
createHashCode in class LanguageLevelVisitor
createEquals
protected void createEquals(SymbolData sd)
- This is a noop, because we do not do code augmentation at the Advanced Level.
- Overrides:
createEquals in class LanguageLevelVisitor
forInterfaceDef
public Void forInterfaceDef(InterfaceDef that)
- Create a SymbolData corresponding to this interface and add it appropriately.
Then visit the body to handle anything defined inside the interface.
Once the interface has been resolved, remove it from _classesInThisFile.
TODO: refactor with same method in IntermediateVisitor; they appear identical
- Specified by:
forInterfaceDef in interface JExpressionIFVisitor<Void>- Overrides:
forInterfaceDef in class JExpressionIFPrunableDepthFirstVisitor
simpleAnonymousClassInstantiationHelper
public void simpleAnonymousClassInstantiationHelper(SimpleAnonymousClassInstantiation that,
SymbolData enclosing)
- Look up the super type of this class instantiation and add it to the symbol table. Visit the body of the class
instantiation. All handling of this as an anonymous inner class (i.e. adding it to the enclosing SD's list of
inner classes, creating a symbol data for the anonyomous inner class, etc) is 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 of this instantiation. When the enclosing 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.
forArrayType
public Void forArrayType(ArrayType that)
- Description copied from interface:
JExpressionIFVisitor
- Process an instance of ArrayType.
- Specified by:
forArrayType in interface JExpressionIFVisitor<Void>- Overrides:
forArrayType in class JExpressionIFPrunableDepthFirstVisitor