From d28871069bb3461cbf277858fbf9696340957506 Mon Sep 17 00:00:00 2001 From: Michal Kordas Date: Mon, 20 Jul 2015 22:07:16 +0200 Subject: [PATCH] Remove dead code from HandlerFactory in Indentation check. #1270 --- pom.xml | 1 - .../checkstyle/checks/indentation/HandlerFactory.java | 10 ++++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 14c4a6edd..68490db67 100644 --- a/pom.xml +++ b/pom.xml @@ -1155,7 +1155,6 @@ .*.checks.indentation.ArrayInitHandler87100 .*.checks.indentation.ElseHandler75100 .*.checks.indentation.AbstractExpressionHandler9197 - .*.checks.indentation.HandlerFactory81100 .*.checks.indentation.LineWrappingHandler8795 .*.checks.indentation.MethodCallLineWrapHandler00 .*.checks.indentation.MethodDefHandler87100 diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java index 186ed7fb0..0d7388ea3 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java @@ -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); }