Skip to content

Commit 987da3b

Browse files
author
Vincent Potucek
committed
Avoid private scope on writeReplace to be reachable for caller and be consistent overall
1 parent 69fa58c commit 987da3b

File tree

9 files changed

+41
-9
lines changed

9 files changed

+41
-9
lines changed

android/guava-testlib/src/com/google/common/testing/DummyProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public String toString() {
129129

130130
// Since type variables aren't serializable, reduce the type down to raw type before
131131
// serialization.
132-
private Object writeReplace() {
132+
Object writeReplace() {
133133
return new DummyHandler(TypeToken.of(interfaceType.getRawType()));
134134
}
135135
}

android/guava-testlib/test/com/google/common/testing/SerializableTesterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public int hashCode() {
103103
return 1;
104104
}
105105

106-
private Object writeReplace() {
106+
Object writeReplace() {
107107
return new OtherForm();
108108
}
109109

android/guava/src/com/google/common/collect/MutableClassToInstanceMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void putAll(Map<? extends Class<? extends @NonNull B>, ? extends B> map)
176176
return Primitives.wrap(type).cast(value);
177177
}
178178

179-
private Object writeReplace() {
179+
Object writeReplace() {
180180
return new SerializedForm<>(delegate());
181181
}
182182

android/guava/src/com/google/common/hash/BloomFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ static long optimalNumOfBits(long n, double p) {
544544
return (long) (-n * Math.log(p) / SQUARED_LOG_TWO);
545545
}
546546

547-
private Object writeReplace() {
547+
Object writeReplace() {
548548
return new SerialForm<T>(this);
549549
}
550550

guava-testlib/src/com/google/common/testing/DummyProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public String toString() {
129129

130130
// Since type variables aren't serializable, reduce the type down to raw type before
131131
// serialization.
132-
private Object writeReplace() {
132+
Object writeReplace() {
133133
return new DummyHandler(TypeToken.of(interfaceType.getRawType()));
134134
}
135135
}

guava-testlib/test/com/google/common/testing/SerializableTesterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public int hashCode() {
103103
return 1;
104104
}
105105

106-
private Object writeReplace() {
106+
Object writeReplace() {
107107
return new OtherForm();
108108
}
109109

guava/src/com/google/common/collect/MutableClassToInstanceMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public void putAll(Map<? extends Class<? extends @NonNull B>, ? extends B> map)
183183
return Primitives.wrap(type).cast(value);
184184
}
185185

186-
private Object writeReplace() {
186+
Object writeReplace() {
187187
return new SerializedForm<>(delegate());
188188
}
189189

guava/src/com/google/common/hash/BloomFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ static long optimalNumOfBits(long n, double p) {
554554
return (long) (-n * Math.log(p) / SQUARED_LOG_TWO);
555555
}
556556

557-
private Object writeReplace() {
557+
Object writeReplace() {
558558
return new SerialForm<T>(this);
559559
}
560560

pom.xml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,42 @@
130130
</execution>
131131
</executions>
132132
</plugin>
133+
<plugin>
134+
<groupId>org.openrewrite.maven</groupId>
135+
<artifactId>rewrite-maven-plugin</artifactId>
136+
</plugin>
133137
</plugins>
134138
<pluginManagement>
135139
<plugins>
136-
<plugin>
140+
<plugin>
141+
<groupId>org.openrewrite.maven</groupId>
142+
<artifactId>rewrite-maven-plugin</artifactId>
143+
<version>6.15.0</version>
144+
<configuration>
145+
<activeRecipes>
146+
<recipe>org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods</recipe>
147+
<recipe>org.openrewrite.staticanalysis.ModifierOrder</recipe>
148+
</activeRecipes>
149+
<exportDatatables>true</exportDatatables>
150+
<failOnDryRunResults>true</failOnDryRunResults>
151+
</configuration>
152+
<executions>
153+
<execution>
154+
<phase>verify</phase>
155+
<goals>
156+
<goal>dryRun</goal>
157+
</goals>
158+
</execution>
159+
</executions>
160+
<dependencies>
161+
<dependency>
162+
<groupId>org.openrewrite.recipe</groupId>
163+
<artifactId>rewrite-static-analysis</artifactId>
164+
<version>2.14.0</version>
165+
</dependency>
166+
</dependencies>
167+
</plugin>
168+
<plugin>
137169
<artifactId>maven-antrun-plugin</artifactId>
138170
<version>1.6</version>
139171
</plugin>

0 commit comments

Comments
 (0)