Skip to content

Commit

Permalink
Merge 20e9861 into f1114c4
Browse files Browse the repository at this point in the history
  • Loading branch information
VadimPanasiuk committed Aug 28, 2015
2 parents f1114c4 + 20e9861 commit 65beb54
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ public void visitToken(DetailAST detailAST)
*/
private static boolean needOptimization(DetailAST logicNode)
{
final DetailAST firstOperand = logicNode.getFirstChild();
final DetailAST secondOperand = getSecondOperand(logicNode);
return !secondOperand.branchContains(TokenTypes.METHOD_CALL)
&& firstOperand.branchContains(TokenTypes.METHOD_CALL);
&& logicNode.branchContains(TokenTypes.METHOD_CALL);
}
/**
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void test() throws Exception
"67: " + getCheckMessage(MSG_KEY, "&&", 67, 38),
"69: " + getCheckMessage(MSG_KEY, "&&", 69, 35),
"72: " + getCheckMessage(MSG_KEY, "&&", 72, 19),
"93: " + getCheckMessage(MSG_KEY, "||", 93, 33),
};
verify(checkConfig, getPath("InputLogicConditionsNeedOptimizationCheck.java"), expected);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,11 @@ private static void test()
String x = "test";
boolean y = x.length() == 3 ? true : false;
}
private void methodInParentheses(){
Object elem = null;
java.util.ArrayList lst = new java.util.ArrayList();
boolean found = lst.remove(elem);
found = (lst.remove(elem)) || found;
found = found || (lst.remove(elem));
}
}

0 comments on commit 65beb54

Please sign in to comment.