[go: up one dir, main page]

Skip to content

Commit

Permalink
fix: missing serialVersionUID of serializable classes (#2344)
Browse files Browse the repository at this point in the history
* fix: add missing serial_version_uid to serializable classes

* chore: make HttpStorageOptions.RetryDependenciesAdapter transient

* chore: fmt

---------

Co-authored-by: BenWhitehead <BenWhitehead@users.noreply.github.com>
  • Loading branch information
rng70-or and BenWhitehead committed Mar 13, 2024
1 parent d99b978 commit 736865b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
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

0 comments on commit 736865b

Please sign in to comment.