Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing serialVersionUID of serializable classes #2344

Merged
merged 3 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -767,6 +767,7 @@ protected StorageSettings.Builder setInternalHeaderProvider(

private static final class NoopGrpcInterceptorProvider
implements GrpcInterceptorProvider, Serializable {
private static long serialVersionUID = -8523033236999805349L;
private static final NoopGrpcInterceptorProvider INSTANCE = new NoopGrpcInterceptorProvider();

@Override
Expand Down
Expand Up @@ -36,6 +36,8 @@
import com.google.cloud.storage.spi.v1.StorageRpc;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableSet;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.Set;

Expand All @@ -52,7 +54,7 @@ public class HttpStorageOptions extends StorageOptions {
private static final String DEFAULT_HOST = "https://storage.googleapis.com";

private final HttpRetryAlgorithmManager retryAlgorithmManager;
private final RetryDependenciesAdapter retryDepsAdapter;
private transient RetryDependenciesAdapter retryDepsAdapter;

private HttpStorageOptions(Builder builder, StorageDefaults serviceDefaults) {
super(builder, serviceDefaults);
Expand Down Expand Up @@ -93,6 +95,11 @@ public boolean equals(Object obj) {
return obj instanceof HttpStorageOptions && baseEquals((HttpStorageOptions) obj);
}

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
this.retryDepsAdapter = new RetryDependenciesAdapter();
}

public static HttpStorageOptions.Builder newBuilder() {
return new HttpStorageOptions.Builder().setHost(DEFAULT_HOST);
}
Expand Down Expand Up @@ -345,8 +352,7 @@ public ServiceRpc create(StorageOptions options) {
* We don't yet want to make HttpStorageOptions itself implement {@link RetryingDependencies} but
* we do need use it in a couple places, for those we create this adapter.
*/
private final class RetryDependenciesAdapter implements RetryingDependencies, Serializable {

private final class RetryDependenciesAdapter implements RetryingDependencies {
private RetryDependenciesAdapter() {}

@Override
Expand Down
Expand Up @@ -26,6 +26,7 @@
* details.
*/
public class Notification extends NotificationInfo {
private static final long serialVersionUID = 3150928330690874200L;

private final StorageOptions options;
private transient Storage storage;
Expand Down
Expand Up @@ -63,6 +63,8 @@ public abstract class StorageOptions extends ServiceOptions<Storage, StorageOpti
/** @deprecated Use {@link HttpStorageFactory} */
@Deprecated
public static class DefaultStorageFactory extends HttpStorageFactory {
private static final long serialVersionUID = -7856840922014956661L;

/** @deprecated Use {@link HttpStorageDefaults#getDefaultServiceFactory()} */
@Deprecated
public DefaultStorageFactory() {
Expand All @@ -73,6 +75,7 @@ public DefaultStorageFactory() {
/** @deprecated Use {@link HttpStorageRpcFactory} */
@Deprecated
public static class DefaultStorageRpcFactory extends HttpStorageRpcFactory {
private static final long serialVersionUID = -7856840922014956661L;

/** @deprecated Use {@link HttpStorageDefaults#getDefaultRpcFactory()} */
@Deprecated
Expand Down
Expand Up @@ -2540,6 +2540,7 @@ private static CommonObjectRequestParams.Builder customerSuppliedKey(
}

private static final class PrefixedNamedField implements NamedField {
private static long serialVersionUID = -4899304145424680141L;

private final String prefix;
private final NamedField delegate;
Expand Down Expand Up @@ -2586,6 +2587,7 @@ public String toString() {
}

private static final class LiteralNamedField implements NamedField {
private static long serialVersionUID = 1422947423774466409L;

private final String name;

Expand Down Expand Up @@ -2627,6 +2629,7 @@ public String toString() {
}

private static final class NestedNamedField implements NamedField {
private static long serialVersionUID = -7623005572810688221L;
private final NamedField parent;
private final NamedField child;

Expand Down