Skip to content

Commit 000558e

Browse files
Copilottrask
andcommitted
Fix IntLiteralCast ErrorProne violations by using float literals instead of casting
Co-authored-by: trask <[email protected]>
1 parent 70fbc40 commit 000558e

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

agent/agent-profiler/agent-alerting/src/test/java/com/microsoft/applicationinsights/alerting/AlertingSubsystemTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ private static AlertingSubsystem getAlertMonitor(
3030
AlertConfiguration.builder()
3131
.setType(AlertMetricType.CPU)
3232
.setEnabled(true)
33-
.setThreshold((float) 80)
33+
.setThreshold(80.0f)
3434
.setProfileDurationSeconds(30)
3535
.setCooldownSeconds(14400)
3636
.build(),
3737
AlertConfiguration.builder()
3838
.setType(AlertMetricType.MEMORY)
3939
.setEnabled(true)
40-
.setThreshold((float) 20)
40+
.setThreshold(20.0f)
4141
.setProfileDurationSeconds(120)
4242
.setCooldownSeconds(14400)
4343
.build(),
@@ -89,14 +89,14 @@ void manualAlertWorks() {
8989
AlertConfiguration.builder()
9090
.setType(AlertMetricType.CPU)
9191
.setEnabled(true)
92-
.setThreshold((float) 80)
92+
.setThreshold(80.0f)
9393
.setProfileDurationSeconds(30)
9494
.setCooldownSeconds(14400)
9595
.build(),
9696
AlertConfiguration.builder()
9797
.setType(AlertMetricType.MEMORY)
9898
.setEnabled(true)
99-
.setThreshold((float) 20)
99+
.setThreshold(20.0f)
100100
.setProfileDurationSeconds(120)
101101
.setCooldownSeconds(14400)
102102
.build(),
@@ -130,14 +130,14 @@ void manualAlertDoesNotTriggerAfterExpired() {
130130
AlertConfiguration.builder()
131131
.setType(AlertMetricType.CPU)
132132
.setEnabled(true)
133-
.setThreshold((float) 80)
133+
.setThreshold(80.0f)
134134
.setProfileDurationSeconds(30)
135135
.setCooldownSeconds(14400)
136136
.build(),
137137
AlertConfiguration.builder()
138138
.setType(AlertMetricType.MEMORY)
139139
.setEnabled(true)
140-
.setThreshold((float) 20)
140+
.setThreshold(20.0f)
141141
.setProfileDurationSeconds(120)
142142
.setCooldownSeconds(14400)
143143
.build(),

agent/agent-tooling/src/test/java/com/microsoft/applicationinsights/agent/internal/profiler/triggers/AlertConfigParserTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void saneDataIsParsed() {
4343
AlertConfiguration.builder()
4444
.setType(AlertMetricType.CPU)
4545
.setEnabled(true)
46-
.setThreshold((float) 80)
46+
.setThreshold(80.0f)
4747
.setProfileDurationSeconds(30)
4848
.setCooldownSeconds(14400)
4949
.build());
@@ -53,7 +53,7 @@ void saneDataIsParsed() {
5353
AlertConfiguration.builder()
5454
.setType(AlertMetricType.MEMORY)
5555
.setEnabled(true)
56-
.setThreshold((float) 20)
56+
.setThreshold(20.0f)
5757
.setProfileDurationSeconds(120)
5858
.setCooldownSeconds(14400)
5959
.build());

buildSrc/src/main/kotlin/ai.errorprone-conventions.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ tasks {
7474

7575
// New checks in ErrorProne 2.38.0 that we want to disable
7676
disable("AddNullMarkedToPackageInfo")
77-
disable("IntLiteralCast")
7877

7978
// Other new checks that cause warnings in our codebase
8079
disable("EnumOrdinal")

0 commit comments

Comments
 (0)