Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.sonar.java.checks;

import javax.annotation.CheckForNull;
import org.apache.commons.lang3.BooleanUtils;
import org.sonar.check.Rule;
import org.sonar.java.model.ExpressionUtils;
import org.sonar.plugins.java.api.tree.BinaryExpressionTree;
Expand All @@ -40,11 +39,11 @@ public void visitForStatement(ForStatementTree forStatement) {

private static boolean isAlwaysFalseCondition(ExpressionTree expression) {
if (expression.is(Tree.Kind.BOOLEAN_LITERAL)) {
return BooleanUtils.isFalse(booleanLiteralValue(expression));
return Boolean.FALSE.equals(booleanLiteralValue(expression));
}
if (expression.is(Tree.Kind.LOGICAL_COMPLEMENT)) {
ExpressionTree subExpression = ((UnaryExpressionTree) expression).expression();
return BooleanUtils.isTrue(booleanLiteralValue(subExpression));
return Boolean.TRUE.equals(booleanLiteralValue(subExpression));
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.apache.commons.lang3.BooleanUtils;
import org.sonar.check.Rule;
import org.sonar.java.model.LineUtils;
import org.sonarsource.analyzer.commons.collections.SetUtils;
Expand Down Expand Up @@ -144,7 +143,7 @@ public void visitBinaryExpression(BinaryExpressionTree tree) {
}

private static boolean requiresParenthesis(Tree.Kind kind1, Tree.Kind kind2) {
return BooleanUtils.isTrue(OPERATORS_RELATION_TABLE.get(new OperatorRelation(kind1, kind2)));
return Boolean.TRUE.equals(OPERATORS_RELATION_TABLE.get(new OperatorRelation(kind1, kind2)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.lang3.BooleanUtils;
import org.sonar.check.Rule;
import org.sonar.java.model.ExpressionUtils;
import org.sonar.plugins.java.api.IssuableSubscriptionVisitor;
Expand Down Expand Up @@ -51,7 +50,7 @@ public void visitNode(Tree tree) {
inMethodOrStaticInitializerOrFinalClass.push(((ClassTree) tree).symbol().isFinal());
} else if (tree.is(Tree.Kind.METHOD, Tree.Kind.STATIC_INITIALIZER)) {
inMethodOrStaticInitializerOrFinalClass.push(Boolean.TRUE);
} else if (BooleanUtils.isFalse(inMethodOrStaticInitializerOrFinalClass.peek()) && THREAD_START.matches((MethodInvocationTree) tree)) {
} else if (Boolean.FALSE.equals(inMethodOrStaticInitializerOrFinalClass.peek()) && THREAD_START.matches((MethodInvocationTree) tree)) {
reportIssue(ExpressionUtils.methodName((MethodInvocationTree) tree), "Move this \"start\" call to another method.");
}
}
Expand Down