Skip to content

Commit 155cf8f

Browse files
cpovirkGoogle Java Core Libraries
authored andcommitted
Withdraw usages of java.io.Serial from the external repo.
They [break our JDiff setup](https://github.com/google/guava/actions/runs/13294400054/job/37123745397). (followup to cl/726154745) I should [finish setting up japicmp](google/error-prone#4311 (comment)), but for now, I want to unbreak publishing documentation for releases and snapshots. (Some of the code formatting ends up a little odd because of how I'm stripping the annotations. We should be able to live with it until I can put the annotations back—or until we discover that they're causing problems _internally_ and need to withdraw them entirely :)) RELNOTES=n/a PiperOrigin-RevId: 726473297
1 parent 8df849d commit 155cf8f

File tree

312 files changed

+547
-887
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

312 files changed

+547
-887
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import com.google.common.annotations.GwtCompatible;
2828
import com.google.common.annotations.GwtIncompatible;
2929
import com.google.common.annotations.J2ktIncompatible;
30-
import java.io.Serial;
3130
import java.util.ArrayList;
3231
import java.util.Arrays;
3332
import java.util.Collection;
@@ -110,15 +109,15 @@ void assertPermitted(Exception exception) {
110109
}
111110
}
112111

113-
@GwtIncompatible @J2ktIncompatible @Serial private static final long serialVersionUID = 0;
112+
@GwtIncompatible @J2ktIncompatible private static final long serialVersionUID = 0;
114113
}
115114

116115
private static final class UnknownElementException extends RuntimeException {
117116
private UnknownElementException(Collection<?> expected, Object actual) {
118117
super("Returned value '" + actual + "' not found. Remaining elements: " + expected);
119118
}
120119

121-
@GwtIncompatible @J2ktIncompatible @Serial private static final long serialVersionUID = 0;
120+
@GwtIncompatible @J2ktIncompatible private static final long serialVersionUID = 0;
122121
}
123122

124123
/**

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com.google.common.annotations.GwtCompatible;
2020
import com.google.common.annotations.GwtIncompatible;
2121
import com.google.common.annotations.J2ktIncompatible;
22-
import java.io.Serial;
2322
import java.io.Serializable;
2423
import org.jspecify.annotations.Nullable;
2524

@@ -57,5 +56,5 @@ public int compareTo(BaseComparable o) {
5756
return s.compareTo(o.s);
5857
}
5958

60-
@GwtIncompatible @J2ktIncompatible @Serial private static final long serialVersionUID = 0;
59+
@GwtIncompatible @J2ktIncompatible private static final long serialVersionUID = 0;
6160
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com.google.common.annotations.GwtCompatible;
2020
import com.google.common.annotations.GwtIncompatible;
2121
import com.google.common.annotations.J2ktIncompatible;
22-
import java.io.Serial;
2322

2423
/**
2524
* Simple derived class to verify that we handle generics correctly.
@@ -32,5 +31,5 @@ public DerivedComparable(String s) {
3231
super(s);
3332
}
3433

35-
@GwtIncompatible @J2ktIncompatible @Serial private static final long serialVersionUID = 0;
34+
@GwtIncompatible @J2ktIncompatible private static final long serialVersionUID = 0;
3635
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import com.google.common.annotations.GwtIncompatible;
2020
import com.google.errorprone.annotations.CanIgnoreReturnValue;
21-
import java.io.Serial;
2221
import java.io.Serializable;
2322
import java.util.AbstractSet;
2423
import java.util.Collection;
@@ -326,5 +325,5 @@ public String toString() {
326325
return delegate.toString();
327326
}
328327

329-
@Serial private static final long serialVersionUID = 0L;
328+
private static final long serialVersionUID = 0L;
330329
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import com.google.common.annotations.GwtIncompatible;
2020
import com.google.errorprone.annotations.CanIgnoreReturnValue;
21-
import java.io.Serial;
2221
import java.io.Serializable;
2322
import java.util.Collection;
2423
import java.util.Comparator;
@@ -254,5 +253,5 @@ public String toString() {
254253
return delegate.toString();
255254
}
256255

257-
@Serial private static final long serialVersionUID = 0L;
256+
private static final long serialVersionUID = 0L;
258257
}

android/guava-testlib/src/com/google/common/collect/testing/features/ConflictingRequirementsException.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com.google.common.annotations.GwtCompatible;
2020
import com.google.common.annotations.GwtIncompatible;
2121
import com.google.common.annotations.J2ktIncompatible;
22-
import java.io.Serial;
2322
import java.util.Set;
2423

2524
/**
@@ -52,5 +51,5 @@ public String getMessage() {
5251
return super.getMessage() + " (source: " + source + ")";
5352
}
5453

55-
@GwtIncompatible @J2ktIncompatible @Serial private static final long serialVersionUID = 0;
54+
@GwtIncompatible @J2ktIncompatible private static final long serialVersionUID = 0;
5655
}

android/guava-testlib/src/com/google/common/collect/testing/features/TesterRequirements.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.google.common.annotations.GwtCompatible;
2222
import com.google.common.annotations.GwtIncompatible;
2323
import com.google.common.annotations.J2ktIncompatible;
24-
import java.io.Serial;
2524
import java.util.Collections;
2625
import java.util.Set;
2726
import org.jspecify.annotations.Nullable;
@@ -81,5 +80,5 @@ public String toString() {
8180
return "{TesterRequirements: present=" + presentFeatures + ", absent=" + absentFeatures + "}";
8281
}
8382

84-
@GwtIncompatible @J2ktIncompatible @Serial private static final long serialVersionUID = 0;
83+
@GwtIncompatible @J2ktIncompatible private static final long serialVersionUID = 0;
8584
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import com.google.common.collect.testing.Helpers;
2626
import com.google.common.collect.testing.features.CollectionFeature;
2727
import com.google.common.testing.SerializableTester;
28-
import java.io.Serial;
2928
import java.io.Serializable;
3029
import java.lang.reflect.Method;
3130
import java.util.Collections;
@@ -69,7 +68,7 @@ private static class BiMapPair<K, V> implements Serializable {
6968
this.backward = original.inverse();
7069
}
7170

72-
@GwtIncompatible @J2ktIncompatible @Serial private static final long serialVersionUID = 0;
71+
@GwtIncompatible @J2ktIncompatible private static final long serialVersionUID = 0;
7372
}
7473

7574
/**

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.common.testing;
1818

19-
import java.io.Serial;
2019
import java.io.Serializable;
2120
import junit.framework.AssertionFailedError;
2221
import junit.framework.TestCase;
@@ -78,11 +77,11 @@ public void testObjectWhichIsEqualButChangesClass() {
7877
}
7978

8079
private static class ClassWhichDoesNotImplementEquals implements Serializable {
81-
@Serial private static final long serialVersionUID = 1L;
80+
private static final long serialVersionUID = 1L;
8281
}
8382

8483
private static class ClassWhichIsAlwaysEqualButHasDifferentHashcodes implements Serializable {
85-
@Serial private static final long serialVersionUID = 2L;
84+
private static final long serialVersionUID = 2L;
8685

8786
@SuppressWarnings("EqualsHashCode")
8887
@Override
@@ -92,7 +91,7 @@ public boolean equals(@Nullable Object other) {
9291
}
9392

9493
private static class ObjectWhichIsEqualButChangesClass implements Serializable {
95-
@Serial private static final long serialVersionUID = 1L;
94+
private static final long serialVersionUID = 1L;
9695

9796
@Override
9897
public boolean equals(@Nullable Object other) {

android/guava-tests/test/com/google/common/base/FunctionsTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import com.google.common.testing.EqualsTester;
2828
import com.google.common.testing.NullPointerTester;
2929
import com.google.common.testing.SerializableTester;
30-
import java.io.Serial;
3130
import java.io.Serializable;
3231
import java.util.Map;
3332
import junit.framework.TestCase;
@@ -369,7 +368,7 @@ public void testConstantSerializable() {
369368

370369
private static class CountingSupplier implements Supplier<Integer>, Serializable {
371370

372-
@GwtIncompatible @J2ktIncompatible @Serial private static final long serialVersionUID = 0;
371+
@GwtIncompatible @J2ktIncompatible private static final long serialVersionUID = 0;
373372

374373
private int value;
375374

0 commit comments

Comments
 (0)