edu.rice.cs.javalanglevels
Class InterfaceBodyTypeChecker

java.lang.Object
  extended by edu.rice.cs.javalanglevels.tree.JExpressionIFDepthFirstVisitor<TypeData>
      extended by edu.rice.cs.javalanglevels.TypeChecker
          extended by edu.rice.cs.javalanglevels.SpecialTypeChecker
              extended by edu.rice.cs.javalanglevels.InterfaceBodyTypeChecker
All Implemented Interfaces:
JExpressionIFVisitor<TypeData>

public class InterfaceBodyTypeChecker
extends SpecialTypeChecker

Do the TypeChecking appropriate to the context of a class body. Common to all Language Levels.


Nested Class Summary
static class InterfaceBodyTypeChecker.InterfaceBodyTypeCheckerTest
          Test the methods declared in the above class.
 
Nested classes/interfaces inherited from class edu.rice.cs.javalanglevels.SpecialTypeChecker
SpecialTypeChecker.BobTest
 
Nested classes/interfaces inherited from class edu.rice.cs.javalanglevels.TypeChecker
TypeChecker.TypeCheckerTest
 
Field Summary
 
Fields inherited from class edu.rice.cs.javalanglevels.SpecialTypeChecker
_data, _thrown, _vars, thingsThatHaveBeenAssigned
 
Fields inherited from class edu.rice.cs.javalanglevels.TypeChecker
_abstractMav, _finalMav, _finalPublicMav, _log, _packageMav, _privateMav, _protectedMav, _publicAbstractMav, _publicMav, _publicStaticMav, NONE, NULL_LITERAL
 
Constructor Summary
InterfaceBodyTypeChecker(SymbolData sd, java.io.File file, java.lang.String packageName, java.util.LinkedList<java.lang.String> importedFiles, java.util.LinkedList<java.lang.String> importedPackages, java.util.LinkedList<VariableData> vars, java.util.LinkedList<Pair<SymbolData,JExpression>> thrown)
           
 
Method Summary
protected  Data _getData()
          The top level type checker does not have a data
 TypeData forAbstractMethodDef(AbstractMethodDef that)
          Resolve all the stuff that is stored in the AbstractMethodDef.
 TypeData forConcreteMethodDef(ConcreteMethodDef that)
          This error should be thrown in the first pass, but throw it again here, just in case
 TypeData forTypeOnly(Type that)
          Try to resolve the type that is referenced.
 TypeData forUninitializedVariableDeclarator(UninitializedVariableDeclarator that)
          All fields in interfaces must be initialized where they are declared, so throw an error.
 
Methods inherited from class edu.rice.cs.javalanglevels.SpecialTypeChecker
canBeAssigned, findClassReference, forArrayInitializerHelper, forBody, forBracedBody, forExpressionStatement, forFormalParameter, forInitializedVariableDeclarator, forInitializedVariableDeclaratorOnly, forInnerClassDef, forInnerInterfaceDef, forInstanceInitializer, forLabeledStatement, forStaticInitializer, forSynchronizedStatement, forThrowStatement, forThrowStatementOnly, forUnbracedBody, forVariableDeclaration, getArgTypesForInvocation, handleMethodInvocation, handleUncheckedException, inStaticMethod, isCheckedException, isUncaughtCheckedException
 
Methods inherited from class edu.rice.cs.javalanglevels.TypeChecker
_addError, _checkAbstractMethods, _getMatchingMethods, _isAssignableFrom, _isAssignableFromWithoutAutoboxing, _lookupMethod, _lookupMethodHelper, _lookupMethodHelper, assertFound, assertInstanceType, checkAccess, checkAccess, checkAccess, checkForCyclicInheritance, cloneVariableDataList, defaultCase, defineTestCaseClass, forBlockOnly, forBreakStatementOnly, forCastExpression, forClassDef, forClassDefOnly, forClassImportStatement, forConcreteMethodDefOnly, forContinueStatementOnly, forExpressionStatementOnly, forInnerClassDefOnly, forInnerInterfaceDefOnly, forInstanceInitializerOnly, forInterfaceDef, forInterfaceDefOnly, forLabeledStatementOnly, forMethodDefOnly, forPackageStatement, forPrimitiveType, forReturnStatementOnly, forStaticInitializerOnly, forSwitchStatementOnly, forTryCatchStatementOnly, getCommonSuperTypeBaseCase, getFieldOrVariable, getFieldOrVariable, getFieldOrVariable, getFieldOrVariable, getQualifiedClassName, getSymbolData, getSymbolData, getSymbolData, getSymbolData, makeArrayOfRetType, notRightPackage
 
Methods inherited from class edu.rice.cs.javalanglevels.tree.JExpressionIFDepthFirstVisitor
forAbstractMethodDefOnly, forAndExpression, forAndExpressionOnly, forAnonymousClassInstantiationOnly, forArrayAccess, forArrayAccessOnly, forArrayInitializer, forArrayInitializerOnly, forArrayInstantiationOnly, forArrayType, forArrayTypeOnly, forAssignmentExpressionOnly, forBinaryExpressionOnly, forBitwiseAndAssignmentExpression, forBitwiseAndAssignmentExpressionOnly, forBitwiseAndExpression, forBitwiseAndExpressionOnly, forBitwiseAssignmentExpressionOnly, forBitwiseBinaryExpressionOnly, forBitwiseNotExpression, forBitwiseNotExpressionOnly, forBitwiseOrAssignmentExpression, forBitwiseOrAssignmentExpressionOnly, forBitwiseOrExpression, forBitwiseOrExpressionOnly, forBitwiseXorAssignmentExpression, forBitwiseXorAssignmentExpressionOnly, forBitwiseXorExpression, forBitwiseXorExpressionOnly, forBlock, forBlockOnly, forBodyOnly, forBooleanExpressionOnly, forBooleanLiteral, forBooleanLiteralOnly, forBracedBodyOnly, forCastExpressionOnly, forCatchBlock, forCatchBlockOnly, forCharLiteral, forCharLiteralOnly, forClassImportStatementOnly, forClassInstantiationOnly, forClassLiteral, forClassLiteralOnly, forClassOrInterfaceType, forClassOrInterfaceTypeOnly, forComparisonExpressionOnly, forComplexAnonymousClassInstantiation, forComplexAnonymousClassInstantiationOnly, forComplexInitializedArrayInstantiation, forComplexInitializedArrayInstantiationOnly, forComplexMethodInvocation, forComplexMethodInvocationOnly, forComplexNamedClassInstantiation, forComplexNamedClassInstantiationOnly, forComplexNameReference, forComplexNameReferenceOnly, forComplexSuperConstructorInvocation, forComplexSuperConstructorInvocationOnly, forComplexSuperReference, forComplexSuperReferenceOnly, forComplexThisConstructorInvocation, forComplexThisConstructorInvocationOnly, forComplexThisReference, forComplexThisReferenceOnly, forComplexUninitializedArrayInstantiation, forComplexUninitializedArrayInstantiationOnly, forCompoundWord, forCompoundWordOnly, forConcreteMethodDefOnly, forConditionalExpression, forConditionalExpressionOnly, forConstructorDef, forConstructorDefOnly, forDefaultCase, forDefaultCaseOnly, forDimensionExpressionList, forDimensionExpressionListOnly, forDivideAssignmentExpression, forDivideAssignmentExpressionOnly, forDivideExpression, forDivideExpressionOnly, forDoStatement, forDoStatementOnly, forDoubleLiteral, forDoubleLiteralOnly, forEmptyExpression, forEmptyExpressionOnly, forEmptyForCondition, forEmptyForConditionOnly, forEmptyStatement, forEmptyStatementOnly, forEqualityExpressionOnly, forEqualsExpression, forEqualsExpressionOnly, forExpressionListOnly, forExpressionOnly, forFloatLiteral, forFloatLiteralOnly, forFormalParameterOnly, forForStatement, forForStatementOnly, forFunctionInvocationOnly, forGreaterThanExpression, forGreaterThanExpressionOnly, forGreaterThanOrEqualExpression, forGreaterThanOrEqualExpressionOnly, forIfThenElseStatement, forIfThenElseStatementOnly, forIfThenStatement, forIfThenStatementOnly, forImportStatementOnly, forIncrementExpressionOnly, forInitializedArrayInstantiationOnly, forInitializerOnly, forInstanceofExpression, forInstanceofExpressionOnly, forInstantiationOnly, forIntegerLiteral, forIntegerLiteralOnly, forJExpressionOnly, forLabeledBreakStatement, forLabeledBreakStatementOnly, forLabeledCase, forLabeledCaseOnly, forLabeledContinueStatement, forLabeledContinueStatementOnly, forLabeledStatementOnly, forLeftShiftAssignmentExpression, forLeftShiftAssignmentExpressionOnly, forLeftShiftExpression, forLeftShiftExpressionOnly, forLessThanExpression, forLessThanExpressionOnly, forLessThanOrEqualExpression, forLessThanOrEqualExpressionOnly, forLexicalLiteralOnly, forLongLiteral, forLongLiteralOnly, forMemberType, forMemberTypeOnly, forMethodDefOnly, forMethodInvocationOnly, forMinusAssignmentExpression, forMinusAssignmentExpressionOnly, forMinusExpression, forMinusExpressionOnly, forModAssignmentExpression, forModAssignmentExpressionOnly, forModExpression, forModExpressionOnly, forModifiersAndVisibility, forModifiersAndVisibilityOnly, forMultiplyAssignmentExpression, forMultiplyAssignmentExpressionOnly, forMultiplyExpression, forMultiplyExpressionOnly, forNamedClassInstantiationOnly, forNameReferenceOnly, forNegativeExpression, forNegativeExpressionOnly, forNegativePostfixIncrementExpression, forNegativePostfixIncrementExpressionOnly, forNegativePrefixIncrementExpression, forNegativePrefixIncrementExpressionOnly, forNoOpExpression, forNoOpExpressionOnly, forNormalTryCatchStatement, forNormalTryCatchStatementOnly, forNotEqualExpression, forNotEqualExpressionOnly, forNotExpression, forNotExpressionOnly, forNullLiteral, forNullLiteralOnly, forNumericAssignmentExpressionOnly, forNumericBinaryExpressionOnly, forNumericUnaryExpressionOnly, forOrExpression, forOrExpressionOnly, forPackageImportStatement, forPackageImportStatementOnly, forPackageStatementOnly, forParenthesized, forParenthesizedExpressionList, forParenthesizedExpressionListOnly, forParenthesizedOnly, forPlusAssignmentExpression, forPlusAssignmentExpressionOnly, forPlusExpression, forPlusExpressionOnly, forPositiveExpression, forPositiveExpressionOnly, forPositivePostfixIncrementExpression, forPositivePostfixIncrementExpressionOnly, forPositivePrefixIncrementExpression, forPositivePrefixIncrementExpressionOnly, forPostfixIncrementExpressionOnly, forPrefixIncrementExpressionOnly, forPrimaryOnly, forPrimitiveTypeOnly, forReferenceTypeOnly, forRightSignedShiftAssignmentExpression, forRightSignedShiftAssignmentExpressionOnly, forRightSignedShiftExpression, forRightSignedShiftExpressionOnly, forRightUnsignedShiftAssignmentExpression, forRightUnsignedShiftAssignmentExpressionOnly, forRightUnsignedShiftExpression, forRightUnsignedShiftExpressionOnly, forShiftAssignmentExpressionOnly, forShiftBinaryExpressionOnly, forSimpleAnonymousClassInstantiation, forSimpleAnonymousClassInstantiationOnly, forSimpleAssignmentExpression, forSimpleAssignmentExpressionOnly, forSimpleInitializedArrayInstantiation, forSimpleInitializedArrayInstantiationOnly, forSimpleMethodInvocation, forSimpleMethodInvocationOnly, forSimpleNamedClassInstantiation, forSimpleNamedClassInstantiationOnly, forSimpleNameReference, forSimpleNameReferenceOnly, forSimpleSuperConstructorInvocation, forSimpleSuperConstructorInvocationOnly, forSimpleSuperReference, forSimpleSuperReferenceOnly, forSimpleThisConstructorInvocation, forSimpleThisConstructorInvocationOnly, forSimpleThisReference, forSimpleThisReferenceOnly, forSimpleUninitializedArrayInstantiation, forSimpleUninitializedArrayInstantiationOnly, forSourceFile, forSourceFileOnly, forStatementOnly, forStringLiteral, forStringLiteralOnly, forSuperConstructorInvocationOnly, forSuperReferenceOnly, forSwitchCaseOnly, forSwitchStatement, forSynchronizedStatementOnly, forThisConstructorInvocationOnly, forThisReferenceOnly, forTryCatchFinallyStatement, forTryCatchFinallyStatementOnly, forTypeDefBaseOnly, forTypeParameter, forTypeParameterOnly, forTypeVariable, forTypeVariableOnly, forUnaryExpressionOnly, forUnbracedBodyOnly, forUninitializedArrayInstantiationOnly, forUninitializedVariableDeclaratorOnly, forUnlabeledBreakStatement, forUnlabeledBreakStatementOnly, forUnlabeledContinueStatement, forUnlabeledContinueStatementOnly, forUnparenthesizedExpressionList, forUnparenthesizedExpressionListOnly, forValueReturnStatement, forValueReturnStatementOnly, forVariableDeclarationOnly, forVariableDeclaratorOnly, forVariableReferenceOnly, forVoidReturn, forVoidReturnOnly, forVoidReturnStatement, forVoidReturnStatementOnly, forWhileStatement, forWhileStatementOnly, forWord, forWordOnly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.rice.cs.javalanglevels.tree.JExpressionIFVisitor
forAndExpression, forArrayAccess, forArrayInitializer, forArrayType, forBitwiseAndAssignmentExpression, forBitwiseAndExpression, forBitwiseNotExpression, forBitwiseOrAssignmentExpression, forBitwiseOrExpression, forBitwiseXorAssignmentExpression, forBitwiseXorExpression, forBlock, forBooleanLiteral, forCatchBlock, forCharLiteral, forClassLiteral, forClassOrInterfaceType, forComplexAnonymousClassInstantiation, forComplexInitializedArrayInstantiation, forComplexMethodInvocation, forComplexNamedClassInstantiation, forComplexNameReference, forComplexSuperConstructorInvocation, forComplexSuperReference, forComplexThisConstructorInvocation, forComplexThisReference, forComplexUninitializedArrayInstantiation, forCompoundWord, forConditionalExpression, forConstructorDef, forDefaultCase, forDimensionExpressionList, forDivideAssignmentExpression, forDivideExpression, forDoStatement, forDoubleLiteral, forEmptyExpression, forEmptyForCondition, forEmptyStatement, forEqualsExpression, forFloatLiteral, forForStatement, forGreaterThanExpression, forGreaterThanOrEqualExpression, forIfThenElseStatement, forIfThenStatement, forInstanceofExpression, forIntegerLiteral, forLabeledBreakStatement, forLabeledCase, forLabeledContinueStatement, forLeftShiftAssignmentExpression, forLeftShiftExpression, forLessThanExpression, forLessThanOrEqualExpression, forLongLiteral, forMemberType, forMinusAssignmentExpression, forMinusExpression, forModAssignmentExpression, forModExpression, forModifiersAndVisibility, forMultiplyAssignmentExpression, forMultiplyExpression, forNegativeExpression, forNegativePostfixIncrementExpression, forNegativePrefixIncrementExpression, forNoOpExpression, forNormalTryCatchStatement, forNotEqualExpression, forNotExpression, forNullLiteral, forOrExpression, forPackageImportStatement, forParenthesized, forParenthesizedExpressionList, forPlusAssignmentExpression, forPlusExpression, forPositiveExpression, forPositivePostfixIncrementExpression, forPositivePrefixIncrementExpression, forRightSignedShiftAssignmentExpression, forRightSignedShiftExpression, forRightUnsignedShiftAssignmentExpression, forRightUnsignedShiftExpression, forSimpleAnonymousClassInstantiation, forSimpleAssignmentExpression, forSimpleInitializedArrayInstantiation, forSimpleMethodInvocation, forSimpleNamedClassInstantiation, forSimpleNameReference, forSimpleSuperConstructorInvocation, forSimpleSuperReference, forSimpleThisConstructorInvocation, forSimpleThisReference, forSimpleUninitializedArrayInstantiation, forSourceFile, forStringLiteral, forSwitchStatement, forTryCatchFinallyStatement, forTypeParameter, forTypeVariable, forUnlabeledBreakStatement, forUnlabeledContinueStatement, forUnparenthesizedExpressionList, forValueReturnStatement, forVoidReturn, forVoidReturnStatement, forWhileStatement, forWord
 

Constructor Detail

InterfaceBodyTypeChecker

public InterfaceBodyTypeChecker(SymbolData sd,
                                java.io.File file,
                                java.lang.String packageName,
                                java.util.LinkedList<java.lang.String> importedFiles,
                                java.util.LinkedList<java.lang.String> importedPackages,
                                java.util.LinkedList<VariableData> vars,
                                java.util.LinkedList<Pair<SymbolData,JExpression>> thrown)
Method Detail

_getData

protected Data _getData()
Description copied from class: TypeChecker
The top level type checker does not have a data

Overrides:
_getData in class SpecialTypeChecker
Returns:
the SymbolData corresponding to the enclosing interface

forUninitializedVariableDeclarator

public TypeData forUninitializedVariableDeclarator(UninitializedVariableDeclarator that)
All fields in interfaces must be initialized where they are declared, so throw an error.

Specified by:
forUninitializedVariableDeclarator in interface JExpressionIFVisitor<TypeData>
Overrides:
forUninitializedVariableDeclarator in class SpecialTypeChecker
Parameters:
that - The UninitializedVariableDeclarator we are visiting.

forAbstractMethodDef

public TypeData forAbstractMethodDef(AbstractMethodDef that)
Resolve all the stuff that is stored in the AbstractMethodDef. Find the method data that was created on the first pass to correspond to this method, and make sure that this method doesn't resolve another method with a different return type.

Specified by:
forAbstractMethodDef in interface JExpressionIFVisitor<TypeData>
Overrides:
forAbstractMethodDef in class JExpressionIFDepthFirstVisitor<TypeData>

forConcreteMethodDef

public TypeData forConcreteMethodDef(ConcreteMethodDef that)
This error should be thrown in the first pass, but throw it again here, just in case

Specified by:
forConcreteMethodDef in interface JExpressionIFVisitor<TypeData>
Overrides:
forConcreteMethodDef in class JExpressionIFDepthFirstVisitor<TypeData>

forTypeOnly

public TypeData forTypeOnly(Type that)
Try to resolve the type that is referenced. Check to see if it is accessible from this context.

Overrides:
forTypeOnly in class JExpressionIFDepthFirstVisitor<TypeData>