Buggy code:
public class DeepCheckingVisitor implements AstVisitor { private final List < SemanticAnalysisException > exceptions = new ArrayList < > ( ) ; private final HashMap < Symbol , ClassScope > classScopes ; private SymbolTable symbolTable = null ; private ClassDeclaration currentClassDeclaration ; private ClassScope currentClassScope = null ; private MethodMemberDeclaration currentMethodDeclaration = null ; private boolean isStaticMethod ; private boolean isMainMethod ; private boolean returnOnAllPaths ; private boolean isExpressionStatement ; public DeepCheckingVisitor ( HashMap < Symbol , ClassScope > classScopes ) { } public List < SemanticAnalysisException > getExceptions ( ) { } private void throwTypeError ( AstNode astNode ) { } private void throwTypeError ( AstNode astNode , String message ) { } private void throwReDeclarationError ( Symbol symbol , Position reDeclarationPosition ) { } private void throwUndefinedSymbolError ( Symbol symbol , Position position ) { } private void throwNoSuchMemberError ( Symbol object , Position objPos , Symbol member , Position memberPos ) { } private void throwIllegalAccessToNonStaticMemberError ( Position objPos ) { } private void throwMainNotCallableError ( MethodInvocationExpression methodInvocation ) { } private void throwMainParameterNotAccessibleError ( VariableAccessExpression variableAccessExpression ) { } private boolean expectType ( Type type , AstNode astNode , boolean negate ) { } private boolean expectType ( Type type , AstNode astNode ) { } private boolean expectType ( BasicType type , AstNode astNode ) { } private boolean expectTypeNot ( BasicType type , AstNode astNode ) { } private void checkBinaryOperandEquality ( BinaryExpression binaryExpression ) { } private void checkExpression ( BinaryExpression binaryExpression , BasicType expected , BasicType result ) { } private void checkExpression ( UnaryExpression unaryExpression , BasicType expected , BasicType result ) { } @ Override public void visit ( AdditionExpression additionExpression ) { } @ Override public void visit ( AssignmentExpression assignmentExpression ) { } @ Override public void visit ( DivisionExpression divisionExpression ) { } @ Override public void visit ( EqualityExpression equalityExpression ) { } @ Override public void visit ( GreaterThanEqualExpression greaterThanEqualExpression ) { } @ Override public void visit ( GreaterThanExpression greaterThanExpression ) { } @ Override public void visit ( LessThanEqualExpression lessThanEqualExpression ) { } @ Override public void visit ( LessThanExpression lessThanExpression ) { } @ Override public void visit ( LogicalAndExpression logicalAndExpression ) { } @ Override public void visit ( LogicalOrExpression logicalOrExpression ) { } @ Override public void visit ( ModuloExpression moduloExpression ) { } @ Override public void visit ( MuliplicationExpression multiplicationExpression ) { } @ Override public void visit ( NonEqualityExpression nonEqualityExpression ) { } @ Override public void visit ( SubtractionExpression substractionExpression ) { } @ Override public void visit ( BooleanConstantExpression booleanConstantExpression ) { } @ Override public void visit ( IntegerConstantExpression integerConstantExpression ) { } @ Override public void visit ( NewArrayExpression newArrayExpression ) { } @ Override public void visit ( NewObjectExpression newObjectExpression ) { } @ Override public void visit ( MethodInvocationExpression methodInvocationExpression ) { } private boolean isStaticBaseExpression ( Expression leftExpression ) { } private void checkCallMethod ( MethodInvocationExpression methodInvocation , ClassScope classScope , boolean staticCall ) { } private void checkParameterDeclarationAndSetReturnType ( MethodInvocationExpression methodInvocation , MethodMemberDeclaration methodDeclaration ) { } @ Override public void visit ( VariableAccessExpression variableAccessExpression ) { } @ Override public void visit ( ArrayAccessExpression arrayAccessExpression ) { } @ Override public void visit ( LogicalNotExpression logicalNotExpression ) { } @ Override public void visit ( NegateExpression negateExpression ) { } @ Override public void visit ( ReturnStatement returnStatement ) { } @ Override public void visit ( ThisExpression thisExpression ) { } @ Override public void visit ( NullExpression nullExpression ) { } @ Override public void visit ( Type type ) { } @ Override public void visit ( ClassType classType ) { } @ Override public void visit ( ArrayType arrayType ) { } @ Override public void visit ( Block block ) { } @ Override public void visit ( ClassDeclaration classDeclaration ) { } @ Override public void visit ( IfStatement ifStatement ) { } @ Override public void visit ( WhileStatement whileStatement ) { } private void acceptStatement ( Statement statement ) { } @ Override public void visit ( Program program ) { } @ Override public void visit ( LocalVariableDeclaration localVariableDeclaration ) { } @ Override public void visit ( ParameterDeclaration parameterDeclaration ) { } @ Override public void visit ( FieldDeclaration fieldDeclaration ) { } @ Override public void visit ( MethodDeclaration methodDeclaration ) { } @ Override public void visit ( MainMethodDeclaration mainMethodDeclaration ) { } @ Override public void visit ( NativeMethodDeclaration nativeMethodDeclaration ) { } private void visitMethodDeclaration ( MethodDeclaration methodDeclaration ) { isStaticMethod = methodDeclaration . isStatic ( ) ; methodDeclaration . getType ( ) . accept ( this ) ; <START_BUG> symbolTable = new SymbolTable ( ) ; <END_BUG> symbolTable . enterScope ( ) ; symbolTable . enterScope ( ) ; for ( ParameterDeclaration parameterDeclaration : methodDeclaration . getParameters ( ) ) { parameterDeclaration . accept ( this ) ; } currentMethodDeclaration = currentClassScope . getMethodDeclaration ( methodDeclaration . getIdentifier ( ) ) ; if ( ( currentMethodDeclaration ) != null ) { returnOnAllPaths = false ; methodDeclaration . getBlock ( ) . accept ( this ) ; if ( ! ( currentMethodDeclaration . getType ( ) . is ( VOID ) ) ) { if ( ! ( returnOnAllPaths ) ) { exceptions . add ( new compiler . semantic . exceptions . MissingReturnStatementOnAPathException ( methodDeclaration . getPosition ( ) , methodDeclaration . getIdentifier ( ) ) ) ; } } } currentMethodDeclaration = null ; symbolTable . leaveAllScopes ( ) ; methodDeclaration . setNumberOfRequiredLocals ( symbolTable . getRequiredLocalVariables ( ) ) ; symbolTable = null ; } }

Fix:
symbolTable = new SymbolTable ( ( methodDeclaration . isStatic ( ) ? 0 : 1 ) ) ;