You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: java-symbolic-execution/java-symbolic-execution-checks-test-sources/src/main/java/symbolicexecution/checks/MinMaxRangeCheckSample.java
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -51,14 +51,14 @@ public double doRangeCheckNOK7(double num) {
51
51
doubleupper = 18.37;
52
52
doublelower = -4.96;
53
53
doubleresult = Math.min(lower, num);
54
-
returnMath.max(result, upper); // Compliant - FN
54
+
returnMath.max(result, upper); // Noncompliant
55
55
}
56
56
57
57
publicdoubledoRangeCheckNOK8(floatnum) {
58
58
floatupper = 18.37f;
59
59
floatlower = -4.96f;
60
60
floatresult = Math.min(lower, num);
61
-
returnMath.max(result, upper); // Compliant - FN
61
+
returnMath.max(result, upper); // Noncompliant
62
62
}
63
63
64
64
publicdoubledoRangeCheckNOK9(longnum) {
@@ -98,11 +98,11 @@ public int doRangeCheckOK5(int num) { // using both time same range
98
98
returnMath.max(LOWER_INT, result);
99
99
}
100
100
101
-
publicintdoRangeCheckOK6(intnum) {// do not handle arithmetic
Copy file name to clipboardExpand all lines: java-symbolic-execution/java-symbolic-execution-plugin/src/main/java/org/sonar/java/model/SEExpressionUtils.java
Copy file name to clipboardExpand all lines: java-symbolic-execution/java-symbolic-execution-plugin/src/main/java/org/sonar/java/model/SELiteralUtils.java
Copy file name to clipboardExpand all lines: java-symbolic-execution/java-symbolic-execution-plugin/src/main/java/org/sonar/java/se/checks/DivisionByZeroCheck.java
+12-13Lines changed: 12 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -395,28 +395,27 @@ public void visitIdentifier(IdentifierTree identifier) {
395
395
}
396
396
Typetype = identifier.symbolType();
397
397
if (type.isPrimitive() || type.isPrimitiveWrapper()) {
398
-
((Symbol.VariableSymbol) symbol).constantValue()
399
-
.filter(Number.class::isInstance)
400
-
.map(Number.class::cast)
401
-
.ifPresent(num -> {
402
-
if (isZero(num, symbol.type().fullyQualifiedName())) {
0 commit comments