Remove dead code from HandlerFactory in Indentation check. #1270

This commit is contained in:
Michal Kordas 2015-07-20 22:07:16 +02:00 committed by Roman Ivanov
parent 3dbb4e095d
commit d28871069b
2 changed files with 4 additions and 7 deletions

View File

@ -1155,7 +1155,6 @@
<regex><pattern>.*.checks.indentation.ArrayInitHandler</pattern><branchRate>87</branchRate><lineRate>100</lineRate></regex>
<regex><pattern>.*.checks.indentation.ElseHandler</pattern><branchRate>75</branchRate><lineRate>100</lineRate></regex>
<regex><pattern>.*.checks.indentation.AbstractExpressionHandler</pattern><branchRate>91</branchRate><lineRate>97</lineRate></regex>
<regex><pattern>.*.checks.indentation.HandlerFactory</pattern><branchRate>81</branchRate><lineRate>100</lineRate></regex>
<regex><pattern>.*.checks.indentation.LineWrappingHandler</pattern><branchRate>87</branchRate><lineRate>95</lineRate></regex>
<regex><pattern>.*.checks.indentation.MethodCallLineWrapHandler</pattern><branchRate>0</branchRate><lineRate>0</lineRate></regex>
<regex><pattern>.*.checks.indentation.MethodDefHandler</pattern><branchRate>87</branchRate><lineRate>100</lineRate></regex>

View File

@ -144,10 +144,8 @@ public class HandlerFactory {
AbstractExpressionHandler expHandler = null;
final Constructor<?> handlerCtor =
typeHandlers.get(ast.getType());
if (handlerCtor != null) {
expHandler = (AbstractExpressionHandler) Utils.invokeConstructor(
handlerCtor, indentCheck, ast, parent);
}
expHandler = (AbstractExpressionHandler) Utils.invokeConstructor(
handlerCtor, indentCheck, ast, parent);
return expHandler;
}
@ -164,10 +162,10 @@ public class HandlerFactory {
DetailAST ast, AbstractExpressionHandler parent) {
AbstractExpressionHandler theParent = parent;
DetailAST astNode = ast.getFirstChild();
while (astNode != null && astNode.getType() == TokenTypes.DOT) {
while (astNode.getType() == TokenTypes.DOT) {
astNode = astNode.getFirstChild();
}
if (astNode != null && isHandledType(astNode.getType())) {
if (isHandledType(astNode.getType())) {
theParent = getHandler(indentCheck, astNode, theParent);
createdHandlers.put(astNode, theParent);
}