Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ReleaseProcess.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The following describes how to perform the steps of the release locally to verif

> [!CAUTION]\
> Be careful with this, these steps might be outdated or incomplete. Double-check that you are working on a copy of your local Gson Git repository and make sure you have followed all steps. To be safe you can also temporarily turn off your internet connection to avoid accidentally pushing changes to the real remote Git or Maven repository.\
> As an alternative to the steps described below you can instead [perform a dry run](https://maven.apache.org/maven-release/maven-release-plugin/usage.html#do-a-dry-run), though this might not behave identical to a real release.
> As an alternative to the steps described below you can instead [perform a dry run](https://maven.apache.org/maven-release/maven-release-plugin/usage.html#do-a-dry-run), though this might not behave identically to a real release.

1. Make a copy of your local Gson Git repository and only work with that copy
1. Make sure you are on the `main` branch
Expand Down
19 changes: 19 additions & 0 deletions gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<project.build.outputTimestamp>2026-10-24T01:07:07Z</project.build.outputTimestamp>

<excludeTestCompilation>**/Java17*</excludeTestCompilation>
<skipJavaTimeTest>false</skipJavaTimeTest>
</properties>

<dependencies>
Expand Down Expand Up @@ -185,6 +186,23 @@
configuration locally). -->
<argLine>--illegal-access=deny</argLine>
</configuration>
<executions>
<!-- Additionally run `JavaTimeTest` with the `java.time` package open for reflection, to ensure backward
compatibility with previous reflection-based serialization -->
<execution>
<id>java-time-test</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
<configuration>
<skipTests>${skipJavaTimeTest}</skipTests>
<argLine>--add-opens java.base/java.time=ALL-UNNAMED</argLine>
<test>JavaTimeTest</test>
<failIfNoTests>true</failIfNoTests>
</configuration>
</execution>
</executions>
</plugin>
<!-- Failsafe plugin for running integration tests against final JAR, see `*IT.java` test classes -->
<plugin>
Expand Down Expand Up @@ -402,6 +420,7 @@
<profile>
<id>gson-subset</id>
<properties>
<skipJavaTimeTest>true</skipJavaTimeTest>
<gsonSubsetSrcDir>${project.build.directory}/gson-subset-src</gsonSubsetSrcDir>
</properties>
<build>
Expand Down
5 changes: 1 addition & 4 deletions gson/src/main/java/com/google/gson/GsonBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -977,10 +977,7 @@ List<TypeAdapterFactory> createFactories(
factories.add(TypeAdapters.BIT_SET_FACTORY);
factories.add(DefaultDateTypeAdapter.DEFAULT_STYLE_FACTORY);
factories.add(TypeAdapters.CALENDAR_FACTORY);
TypeAdapterFactory javaTimeFactory = TypeAdapters.javaTimeTypeAdapterFactory();
if (javaTimeFactory != null) {
factories.add(javaTimeFactory);
}
factories.add(TypeAdapters.JAVA_TIME_FACTORY);
factories.add(TypeAdapters.JDK_OPTIONAL_FACTORY);
factories.addAll(SqlTypesSupport.SQL_TYPE_FACTORIES);
factories.add(ArrayTypeAdapter.FACTORY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
};

/**
* Taken from Java 19 method {@link HashMap.newHashMap}, using default load factor {@code 0.75F}.
* Calculates the 'capacity' needed to hold {@code numMappings} entries without resizing, using
* default load factor {@code 0.75F}.
*
* <p>Taken from Java 19 method {@code HashMap#newHashMap}.
*/
private static int calculateHashMapCapacity(int numMappings) {
return (int) Math.ceil(numMappings / 0.75F);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2026 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.gson.internal.bind;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Used for animal-sniffer-maven-plugin to suppress warnings about API being unavailable for the
* target Android API Level.
*/
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE, ElementType.FIELD})
@SuppressWarnings("IdentifierName")
@interface IgnoreAndroidApiLevelRequirement {}

This file was deleted.

Loading
Loading