Skip to content

Commit 9630694

Browse files
authored
refactor: Remove redundant protected access modifiers and enable the ProtectedMembersInFinalClass ErrorProne check. (#37757)
1 parent e7a97c2 commit 9630694

6 files changed

Lines changed: 6 additions & 8 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
@@ -1559,7 +1559,6 @@ class BeamModulePlugin implements Plugin<Project> {
15591559
"MixedMutabilityReturnType",
15601560
"PreferJavaTimeOverload",
15611561
"NonCanonicalType",
1562-
"ProtectedMembersInFinalClass",
15631562
"Slf4jFormatShouldBeConst",
15641563
"Slf4jSignOnlyFormat",
15651564
"StaticAssignmentInConstructor",

runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/common/worker/CachingShuffleBatchReader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ public Batch read(@Nullable ShufflePosition startPosition, @Nullable ShufflePosi
8383

8484
/** The key for the entries stored in the batch cache. */
8585
static final class BatchRange {
86-
protected final @Nullable ShufflePosition startPosition;
87-
protected final @Nullable ShufflePosition endPosition;
86+
final @Nullable ShufflePosition startPosition;
87+
final @Nullable ShufflePosition endPosition;
8888

8989
public BatchRange(
9090
@Nullable ShufflePosition startPosition, @Nullable ShufflePosition endPosition) {

sdks/java/core/src/main/java/org/apache/beam/sdk/coders/DelegateCoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private <InputT, OutputT> OutputT applyAndWrapExceptions(
176176
// to try to deduce a good type descriptor.
177177
private final @Nullable TypeDescriptor<T> typeDescriptor;
178178

179-
protected DelegateCoder(
179+
DelegateCoder(
180180
Coder<IntermediateT> coder,
181181
CodingFunction<T, IntermediateT> toFn,
182182
CodingFunction<IntermediateT, T> fromFn,

sdks/java/core/src/main/java/org/apache/beam/sdk/coders/StringDelegateCoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public String toString() {
5858
private final DelegateCoder<T, String> delegateCoder;
5959
private final Class<T> clazz;
6060

61-
protected StringDelegateCoder(final Class<T> clazz, TypeDescriptor<T> typeDescriptor) {
61+
StringDelegateCoder(final Class<T> clazz, TypeDescriptor<T> typeDescriptor) {
6262
delegateCoder =
6363
DelegateCoder.of(
6464
StringUtf8Coder.of(),

sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,8 +1177,7 @@ public static final class FileResultCoder<DestinationT>
11771177
private final Coder<BoundedWindow> windowCoder;
11781178
private final Coder<DestinationT> destinationCoder;
11791179

1180-
protected FileResultCoder(
1181-
Coder<BoundedWindow> windowCoder, Coder<DestinationT> destinationCoder) {
1180+
FileResultCoder(Coder<BoundedWindow> windowCoder, Coder<DestinationT> destinationCoder) {
11821181
this.windowCoder = NullableCoder.of(windowCoder);
11831182
this.destinationCoder = destinationCoder;
11841183
}

sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/firestore/PartitionQueryResponseToRunQueryRequestTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"initialization.fields.uninitialized") // mockito fields are initialized via the Mockito Runner
5151
public final class PartitionQueryResponseToRunQueryRequestTest {
5252

53-
@Mock protected DoFn<PartitionQueryPair, RunQueryRequest>.ProcessContext processContext;
53+
@Mock DoFn<PartitionQueryPair, RunQueryRequest>.ProcessContext processContext;
5454

5555
private final StructuredQuery query =
5656
StructuredQuery.newBuilder()

0 commit comments

Comments
 (0)