refactoring TreeTypeChecker.java