Skip to content

Commit e87e581

Browse files
committed
fix checkstyle
1 parent cab9169 commit e87e581

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/BoundedTrieData.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ public BoundedTrieNode() {
345345
* @param truncated Whether this node is truncated.
346346
* @param size The size of the subtree rooted at this node.
347347
*/
348-
public BoundedTrieNode(@Nonnull Map<String, BoundedTrieNode> children, boolean truncated, int size) {
348+
public BoundedTrieNode(
349+
@Nonnull Map<String, BoundedTrieNode> children, boolean truncated, int size) {
349350
this.children = children;
350351
this.size = size;
351352
this.truncated = truncated;

runners/google-cloud-dataflow-java/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ dependencies {
112112
implementation library.java.google_auth_library_oauth2_http
113113
implementation library.java.google_http_client
114114
implementation library.java.google_http_client_gson
115+
implementation library.java.protobuf_java
115116
permitUnusedDeclared library.java.google_http_client_gson // BEAM-11761
116117
implementation library.java.hamcrest
117118
implementation library.java.jackson_annotations

runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowMetrics.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ private DistributionResult getDistributionValue(MetricUpdate metricUpdate) {
241241

242242
/** Translate Struct proto returned by Dataflow API client to BoundedTrieData. */
243243
@VisibleForTesting
244-
@SuppressWarnings("ReferenceEquality") // compare with protobuf Struct default instance
244+
@SuppressWarnings("ReferenceEquality") // Compare with protobuf Struct default instance
245245
static BoundedTrieData trieFromStruct(com.google.protobuf.Struct responseProto) {
246246
Map<String, com.google.protobuf.Value> fieldsMap = responseProto.getFieldsMap();
247247
int bound = 0;
@@ -271,7 +271,7 @@ static BoundedTrieData trieFromStruct(com.google.protobuf.Struct responseProto)
271271
/**
272272
* Translate Struct proto returned by Dataflow API client to BoundedTrieData.BoundedTrieNode.
273273
*/
274-
@SuppressWarnings("ReferenceEquality") // compare with protobuf Struct default instance
274+
@SuppressWarnings({"ReferenceEquality"}) // Compare with protobuf Struct default instance
275275
private static BoundedTrieData.BoundedTrieNode trieNodeFromStruct(
276276
com.google.protobuf.Struct responseProto) {
277277
Map<String, com.google.protobuf.Value> fieldsMap = responseProto.getFieldsMap();

runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/DataflowMetricsTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import com.google.api.services.dataflow.model.JobMetrics;
4040
import com.google.api.services.dataflow.model.MetricStructuredName;
4141
import com.google.api.services.dataflow.model.MetricUpdate;
42-
import com.google.protobuf.Struct;
4342
import com.google.protobuf.TextFormat;
4443
import com.google.protobuf.TextFormat.ParseException;
4544
import java.io.IOException;
@@ -328,7 +327,8 @@ public void testSingletonBoundedTrieFromMessage() throws ParseException {
328327
+ " }\n"
329328
+ " }\n"
330329
+ " }";
331-
Struct response = TextFormat.parse(textProto, Struct.class);
330+
com.google.protobuf.Struct response =
331+
TextFormat.parse(textProto, com.google.protobuf.Struct.class);
332332
BoundedTrieData result = DataflowMetrics.DataflowMetricResultExtractor.trieFromStruct(response);
333333
assertEquals(
334334
"BoundedTrieData({'pubsub:topic:`google.com:abc`.some-topicfalse'})", result.toString());
@@ -416,7 +416,8 @@ public void testNestedBoundedTrieFromMessage() throws ParseException {
416416
+ " }\n"
417417
+ " }\n"
418418
+ "}";
419-
Struct response = TextFormat.parse(textProto, Struct.class);
419+
com.google.protobuf.Struct response =
420+
TextFormat.parse(textProto, com.google.protobuf.Struct.class);
420421
BoundedTrieData result = DataflowMetrics.DataflowMetricResultExtractor.trieFromStruct(response);
421422
assertEquals("BoundedTrieData({'gcs:some-bucket.some-folder/true'})", result.toString());
422423
}

sdks/java/build-tools/src/main/resources/beam/checkstyle/suppressions.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090
<suppress id="ForbidNonVendoredGrpcProtobuf" files=".*testinfra.*mockapis.*" />
9191
<suppress id="ForbidNonVendoredGrpcProtobuf" files=".*requestresponse.*" />
9292
<suppress id="ForbidNonVendoredGrpcProtobuf" files=".*examples.*webapis.*" />
93+
<suppress id="ForbidNonVendoredGrpcProtobuf" files=".*runners.*dataflow.*DataflowMetrics\.java" />
94+
<suppress id="ForbidNonVendoredGrpcProtobuf" files=".*runners.*dataflow.*DataflowMetricsTest\.java" />
9395

9496
<!-- Flink -->
9597
<!-- Checkstyle does not correctly detect package files across multiple source directories. -->

0 commit comments

Comments
 (0)