Remove dead code from ElseHandler in Indentation check. #1270

This commit is contained in:
Michal Kordas 2015-07-20 22:38:32 +02:00 committed by Roman Ivanov
parent e1d06c0a92
commit 79694f0d50
2 changed files with 6 additions and 11 deletions

View File

@ -1148,8 +1148,6 @@
<regex><pattern>.*.checks.imports.CustomImportOrderCheck</pattern><branchRate>98</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.MethodCallLineWrapHandler</pattern><branchRate>0</branchRate><lineRate>0</lineRate></regex>
<regex><pattern>.*.checks.indentation.ObjectBlockHandler</pattern><branchRate>75</branchRate><lineRate>100</lineRate></regex>

View File

@ -48,15 +48,12 @@ public class ElseHandler extends BlockParentHandler {
// } else ...
final DetailAST ifAST = getMainAst().getParent();
if (ifAST != null) {
final DetailAST slist = ifAST.findFirstToken(TokenTypes.SLIST);
if (slist != null) {
final DetailAST lcurly = slist.getLastChild();
if (lcurly != null
&& lcurly.getLineNo() == getMainAst().getLineNo()) {
// indentation checked as part of LITERAL IF check
return;
}
final DetailAST slist = ifAST.findFirstToken(TokenTypes.SLIST);
if (slist != null) {
final DetailAST lcurly = slist.getLastChild();
if (lcurly.getLineNo() == getMainAst().getLineNo()) {
// indentation checked as part of LITERAL IF check
return;
}
}
super.checkToplevelToken();