Skip to content

Commit

Permalink
SONARJAVA-2209 Fix handling of (-1) (#1342) (#1343)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wohops authored Mar 27, 2017
1 parent fee94e8 commit 041066d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private static boolean isUsualDefaultValue(ExpressionTree tree) {
return "0".equals(value) || "1".equals(value);
case UNARY_MINUS:
case UNARY_PLUS:
return isUsualDefaultValue(((UnaryExpressionTree) tree).expression());
return isUsualDefaultValue(((UnaryExpressionTree) expr).expression());
default:
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion java-checks/src/test/files/checks/DeadStoreCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ int testIntLiterals() {
b = 0; // Noncompliant
b = 1; // Noncompliant
int c = +1; // Compliant
int d = -(1); // Compliant
int d = (-1); // Compliant
int e = -1; // Compliant

// Only int literals are excluded
Expand Down

0 comments on commit 041066d

Please sign in to comment.