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-checks/src/test/files/checks/IncDecOnFPCheck.java
+20-2Lines changed: 20 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,28 @@
1
1
classA {
2
-
voidspecExample() {
3
-
for (floatx = 16_000_000; x < 17_000_000; x++) { // Noncompliant {{Increment and decrement operators (++/--) should not be used with floating point variables}}
2
+
voidspecNonCompliantExamples() {
3
+
for (floati = 16_000_000; i < 17_000_000; i++) { // Noncompliant {{Increment and decrement operators (++/--) should not be used with floating point variables}}
4
4
// ^^^
5
5
// ...
6
6
}
7
+
8
+
9
+
floatx = 0f;
10
+
doubley = 1.0;
11
+
12
+
x++; // Noncompliant {{Increment and decrement operators (++/--) should not be used with floating point variables}}
13
+
// ^^^
14
+
y--; // Noncompliant {{Increment and decrement operators (++/--) should not be used with floating point variables}}
15
+
// ^^^
7
16
}
17
+
18
+
voidspecCompliantExamples() {
19
+
floatx = 0f;
20
+
doubley = 1.0;
21
+
22
+
x += 1.0; // Compliant
23
+
y -= 1.0; // Compliant
24
+
}
25
+
8
26
voidfloatIsNotCompliant() {
9
27
floaty = 0.1f;
10
28
y++; // Noncompliant {{Increment and decrement operators (++/--) should not be used with floating point variables}}
0 commit comments