JCLOUDS-1618: Upgrade to gson 2.10.1

This commit is contained in:
Andrew Gaul 2023-01-23 17:01:19 +09:00 committed by Andrew Gaul
parent 2275637fb8
commit 8075bbe50a
4 changed files with 11 additions and 4 deletions

View File

@ -38,6 +38,7 @@ import org.jclouds.domain.JsonBall;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.json.Json;
import org.jclouds.json.SerializedNames;
import com.google.gson.ReflectionAccessFilter;
import com.google.gson.internal.ConstructorConstructor;
import com.google.gson.internal.Excluder;
import com.google.gson.internal.JsonReaderInternalAccess;
@ -61,6 +62,7 @@ import org.jclouds.json.internal.NullFilteringTypeAdapterFactories.SetTypeAdapte
import org.jclouds.json.internal.NullHackJsonLiteralAdapter;
import org.jclouds.json.internal.OptionalTypeAdapterFactory;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.ImmutableSet;
@ -131,7 +133,7 @@ public class GsonModule extends AbstractModule {
ImmutableSet.of(new ExtractNamed()));
builder.registerTypeAdapterFactory(new DeserializationConstructorAndReflectiveTypeAdapterFactory(
new ConstructorConstructor(ImmutableMap.<Type, InstanceCreator<?>>of()), serializationPolicy,
new ConstructorConstructor(ImmutableMap.<Type, InstanceCreator<?>>of(), /*useJdkUnsafe=*/ false, ImmutableList.<ReflectionAccessFilter>of()), serializationPolicy,
Excluder.DEFAULT, deserializationPolicy));
// complicated (serializers/deserializers as they need context to operate)

View File

@ -26,6 +26,7 @@ import java.lang.reflect.Modifier;
import java.util.List;
import java.util.Map;
import com.google.gson.ReflectionAccessFilter;
import com.google.gson.internal.bind.JsonAdapterAnnotationTypeAdapterFactory;
import com.google.gson.internal.ConstructorConstructor;
import com.google.gson.internal.Excluder;
@ -35,6 +36,7 @@ import org.jclouds.json.internal.NamingStrategies.AnnotationConstructorNamingStr
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.reflect.Invokable;
@ -117,7 +119,7 @@ public final class DeserializationConstructorAndReflectiveTypeAdapterFactory imp
"deserializationFieldNamingPolicy");
this.delegateFactory = new ReflectiveTypeAdapterFactory(constructorConstructor, checkNotNull(
serializationFieldNamingPolicy, "fieldNamingPolicy"), checkNotNull(excluder, "excluder"),
new JsonAdapterAnnotationTypeAdapterFactory(constructorConstructor));
new JsonAdapterAnnotationTypeAdapterFactory(constructorConstructor), ImmutableList.<ReflectionAccessFilter>of());
}
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {

View File

@ -31,6 +31,7 @@ import javax.inject.Inject;
import javax.inject.Named;
import org.jclouds.json.SerializedNames;
import com.google.gson.ReflectionAccessFilter;
import com.google.gson.internal.ConstructorConstructor;
import com.google.gson.internal.Excluder;
import org.jclouds.json.internal.NamingStrategies.AnnotationConstructorNamingStrategy;
@ -41,6 +42,7 @@ import org.testng.annotations.Test;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
@ -67,7 +69,8 @@ public final class DeserializationConstructorAndReflectiveTypeAdapterFactoryTest
ImmutableSet.of(ConstructorProperties.class, SerializedNames.class, Inject.class),
ImmutableSet.of(new ExtractNamed()));
return new DeserializationConstructorAndReflectiveTypeAdapterFactory(new ConstructorConstructor(ImmutableMap.<Type, InstanceCreator<?>>of()),
return new DeserializationConstructorAndReflectiveTypeAdapterFactory(
new ConstructorConstructor(ImmutableMap.<Type, InstanceCreator<?>>of(), /*useJdkUnsafe=*/ false, ImmutableList.<ReflectionAccessFilter>of()),
serializationPolicy, Excluder.DEFAULT, deserializationPolicy);
}

View File

@ -221,7 +221,7 @@
<maven-surefire-plugin.version>3.1.0</maven-surefire-plugin.version>
<!-- General dependency versions -->
<gson.version>2.8.9</gson.version>
<gson.version>2.10.1</gson.version>
<guava.version>32.0.0-jre</guava.version>
<guice.version>5.1.0</guice.version>