Skip to content

Commit 8c48120

Browse files
authored
Enable error_prone UnnecessaryLongToIntConversion check (#37783)
1 parent fa9d190 commit 8c48120

5 files changed

Lines changed: 6 additions & 7 deletions

File tree

buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1569,7 +1569,6 @@ class BeamModulePlugin implements Plugin<Project> {
15691569
"NullableTypeParameter",
15701570
"NullableWildcard",
15711571
"SuperCallToObjectMethod",
1572-
"UnnecessaryLongToIntConversion",
15731572
"UnusedVariable",
15741573
// intended suppressions emerged in newer protobuf versions
15751574
// For backward compatibility. Public method checked in before this check impl

runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/streaming/config/StreamingEngineComputationConfigFetcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ private StreamingGlobalConfig createPipelineConfig(StreamingConfigTask config) {
181181
if (config.getMaxWorkItemCommitBytes() != null
182182
&& config.getMaxWorkItemCommitBytes() > 0
183183
&& config.getMaxWorkItemCommitBytes() <= Integer.MAX_VALUE) {
184-
operationalLimits.setMaxWorkItemCommitBytes(config.getMaxWorkItemCommitBytes().intValue());
184+
operationalLimits.setMaxWorkItemCommitBytes(config.getMaxWorkItemCommitBytes());
185185
}
186186

187187
if (config.getOperationalLimits() != null) {

runners/samza/src/test/java/org/apache/beam/runners/samza/metrics/TestSamzaRunnerWithTransformMetrics.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public void testSamzaInputAndOutputMetricOp() {
245245
// Latency must be positive
246246
assertTrue(latency.getSnapshot().getAverage() > 0);
247247
// Cache size must be 0
248-
assertEquals(0, cacheSize.getValue().intValue());
248+
assertEquals(0L, cacheSize.getValue().longValue());
249249
}
250250

251251
@Test
@@ -318,6 +318,6 @@ public void testSamzaInputAndOutputGBKMetricOp() {
318318
// Latency must be positive
319319
assertTrue(latency.getSnapshot().getAverage() > 0);
320320
// Cache size must be 0
321-
assertEquals(0, cacheSize.getValue().intValue());
321+
assertEquals(0L, cacheSize.getValue().longValue());
322322
}
323323
}

runners/samza/src/test/java/org/apache/beam/runners/samza/metrics/TestSamzaTransformMetricsRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void testSamzaTransformMetricsRegistryForNonShuffleOperators() {
102102
.get("dummy-pvalue.out")
103103
.containsKey(watermarkMessage.getTimestamp()));
104104
// Cache size must be 0
105-
assertEquals(0, cacheSize.getValue().intValue());
105+
assertEquals(0L, cacheSize.getValue().longValue());
106106
}
107107

108108
@Test
@@ -186,6 +186,6 @@ public Instant maxTimestamp() {
186186
// Check the latency metric is same
187187
assertTrue(1000 == latency.getSnapshot().getAverage());
188188
// Cache size must be 0
189-
assertEquals(0, cacheSize.getValue().intValue());
189+
assertEquals(0L, cacheSize.getValue().longValue());
190190
}
191191
}

sdks/java/io/pulsar/src/test/java/org/apache/beam/sdk/io/pulsar/PulsarIOIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public void testReadFromSimpleTopic() throws PulsarClientException {
188188
break;
189189
}
190190
}
191-
assertEquals(inputsMock.size(), (int) recordsCount);
191+
assertEquals(inputsMock.size(), recordsCount);
192192
}
193193

194194
@Test

0 commit comments

Comments
 (0)