Commit Graph

1815 Commits

Author SHA1 Message Date
Nathan Herring
d2aee6502b
Add explicit support for floats in JsonTreeWriter. (#2132)
Follow-up to comments on #2130, which introduced a new override which was not overridden by `JsonTreeWriter`. Also tweaks the doccomments for `float`, `double` and `Number` variants of `JsonWriter.value`.

Supplement to the fix for #1127.
2022-06-21 09:50:07 -07:00
dependabot[bot]
08d4572fc4
Bump proguard-maven-plugin from 2.5.3 to 2.6.0 (#2136)
Bumps [proguard-maven-plugin](https://github.com/wvengen/proguard-maven-plugin) from 2.5.3 to 2.6.0.
- [Release notes](https://github.com/wvengen/proguard-maven-plugin/releases)
- [Changelog](https://github.com/wvengen/proguard-maven-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/wvengen/proguard-maven-plugin/commits)

---
updated-dependencies:
- dependency-name: com.github.wvengen:proguard-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-20 17:01:20 -07:00
Marcono1234
57225c6741
Fail when parsing invalid local date (#2134)
* Fail when parsing invalid local date

* Improve invalid date tests
2022-06-16 13:47:57 -07:00
Nathan Herring
96ab171eb4
Add explicit support for floats in JsonWriter. (#2130)
This avoids floats being treated as doubles and having an unwarranted level of precision.

Fixes #1127.
2022-06-08 15:04:42 -07:00
dependabot[bot]
15b9fa9c31
Bump maven-surefire-plugin from 3.0.0-M6 to 3.0.0-M7 (#2128)
Bumps [maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.0.0-M6 to 3.0.0-M7.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.0.0-M6...surefire-3.0.0-M7)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-08 07:21:23 -07:00
dependabot[bot]
d1fce29b27
Bump bnd-maven-plugin from 6.2.0 to 6.3.1 (#2129)
Bumps [bnd-maven-plugin](https://github.com/bndtools/bnd) from 6.2.0 to 6.3.1.
- [Release notes](https://github.com/bndtools/bnd/releases)
- [Changelog](https://github.com/bndtools/bnd/blob/master/docs/ADDING_RELEASE_DOCS.md)
- [Commits](https://github.com/bndtools/bnd/compare/6.2.0...6.3.1)

---
updated-dependencies:
- dependency-name: biz.aQute.bnd:bnd-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-08 07:21:02 -07:00
dependabot[bot]
827e117f6d
Bump maven-scm-api from 1.12.2 to 1.13.0 (#2125)
Bumps [maven-scm-api](https://github.com/apache/maven-scm) from 1.12.2 to 1.13.0.
- [Release notes](https://github.com/apache/maven-scm/releases)
- [Commits](https://github.com/apache/maven-scm/compare/maven-scm-1.12.2...maven-scm-1.13.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.scm:maven-scm-api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-30 11:27:35 -07:00
dependabot[bot]
513b53a084
Bump maven-scm-provider-gitexe from 1.12.2 to 1.13.0 (#2126)
Bumps maven-scm-provider-gitexe from 1.12.2 to 1.13.0.

---
updated-dependencies:
- dependency-name: org.apache.maven.scm:maven-scm-provider-gitexe
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-30 11:27:19 -07:00
Marcono1234
66c3f48d81
Update CodeQL action in GitHub workflow (#2116) 2022-05-16 12:20:13 -07:00
dependabot[bot]
f4b5462c3b
Bump maven-javadoc-plugin from 3.3.2 to 3.4.0 (#2108)
Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.3.2 to 3.4.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.3.2...maven-javadoc-plugin-3.4.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-16 11:43:34 -07:00
dependabot[bot]
5a9febe905
Bump jackson-databind from 2.13.2.2 to 2.13.3 (#2115)
Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.13.2.2 to 2.13.3.
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-16 09:15:10 -07:00
Marcono1234
b1c399fd62
Improve TypeToken creation validation (#2072)
* Add comments regarding multiple bounds of wildcard

* Remove WildcardType check in getCollectionElementType

The returned Type is never a wildcard due to the changes made to getSupertype
by commit b1fb9ca9a1.

* Remove redundant getRawType call from MapTypeAdapterFactory

getRawType(TypeToken.getType()) is the same as calling TypeToken.getRawType().

* Make TypeToken members private

* Remove incorrect statement about TypeToken wildcards

It is possible to use wildcards as part of the type argument, e.g.:
`new TypeToken<List<? extends CharSequence>>() {}`

* Only allow direct subclasses of TypeToken

Previously subclasses of subclasses (...) of TypeToken were allowed which
can behave incorrectly when retrieving the type argument, e.g.:

  class SubTypeToken<T> extends TypeToken<Integer> {}
  new SubTypeToken<String>() {}.getType()

This returned `String` despite the class extending TypeToken<Integer>.

* Throw exception when TypeToken captures type variable

Due to type erasure the runtime type argument for a type variable is not
available. Therefore there is no point in capturing a type variable and it
might even give a false sense of type-safety.

* Make $Gson$Types members private

* Rename $Gson$Types.getGenericSupertype parameter

Rename the method parameter to match the documentation of the method and
to be similar to getSupertype(...).

* Improve tests and handle raw TypeToken supertype better

* Make some $Gson$Types members package-private again to prevent synthetic accessors

* Remove TypeToken check for type variable

As mentioned in review comments, there are cases during serialization where
usage of the type variable is not so problematic (but still not ideal).
2022-04-19 08:20:58 -07:00
Marcono1234
feaf8ddc05
Reduce Maven console output for CodeQL analysis; cache Maven repo (#2105) 2022-04-18 06:52:53 -07:00
Marcono1234
4dda4ec5ba
Use diamond operator when creating generic instances (#2104) 2022-04-17 15:27:21 -07:00
Marcono1234
e82637c485
Add support for reflection access filter (#1905)
* Add support for reflection access filter

* Improve documentation

* Fix compilation errors

* Relax handling for BLOCK_ALL when invoking default constructor

* Improve handling for inherited fields

* Fix accessible test failing for static fields

* Simplify ReflectiveTypeAdapterFactory field writing

* Fix GsonBuilder changes affecting created Gson instances

* Improve documentation

* Improve handling for IllegalAccessException

For Java < 9, AccessibleObject.canAccess is not available and therefore checks
might pass even if object is not accessible, causing IllegalAccessException
later.

* Fix incorrect GsonBuilder.addReflectionAccessFilter documentation
2022-04-17 09:05:18 -07:00
dependabot[bot]
f79ea208b1
Bump maven-surefire-plugin from 3.0.0-M5 to 3.0.0-M6 (#2101)
Bumps [maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.0.0-M5 to 3.0.0-M6.
- [Release notes](https://github.com/apache/maven-surefire/releases)
- [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.0.0-M5...surefire-3.0.0-M6)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-03 20:08:33 -07:00
dependabot[bot]
463bb7d096
Bump jackson-databind from 2.13.2 to 2.13.2.2 (#2096)
Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.13.2 to 2.13.2.2.
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-03 20:05:33 -07:00
kentrachmat
b2b1424582
codegen removal (#2099)
* Delete CodeGenFunctionalTest.java

* codegen removal

* pom.xml update

* email config

* Remove unnecessary space change.

Co-authored-by: Éamonn McManus <emcmanus@google.com>
2022-04-03 20:00:54 -07:00
dependabot[bot]
774c751a9e
Bump jackson-databind from 2.13.1 to 2.13.2 (#2087)
Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.13.1 to 2.13.2.
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson.core:jackson-databind
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-13 13:39:48 -07:00
dependabot[bot]
49c75804c5
Bump maven-compiler-plugin from 3.10.0 to 3.10.1 (#2089)
Bumps [maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.10.0 to 3.10.1.
- [Release notes](https://github.com/apache/maven-compiler-plugin/releases)
- [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.10.0...maven-compiler-plugin-3.10.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-compiler-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-13 13:28:47 -07:00
dependabot[bot]
bab0f5a1f7
Bump maven-compiler-plugin from 3.9.0 to 3.10.0 (#2078)
Bumps [maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.9.0 to 3.10.0.
- [Release notes](https://github.com/apache/maven-compiler-plugin/releases)
- [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.9.0...maven-compiler-plugin-3.10.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-compiler-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-01 11:03:16 -08:00
Marcono1234
d7f824119c
Mention in README that Gson is in maintenance mode (#2085) 2022-03-01 08:57:24 -08:00
dependabot[bot]
ba5f8f9e53
Bump guava from 31.0.1-jre to 31.1-jre (#2086)
Bumps [guava](https://github.com/google/guava) from 31.0.1-jre to 31.1-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-01 08:17:27 -08:00
dependabot[bot]
9125653278
Bump bnd-maven-plugin from 6.1.0 to 6.2.0 (#2084)
Bumps [bnd-maven-plugin](https://github.com/bndtools/bnd) from 6.1.0 to 6.2.0.
- [Release notes](https://github.com/bndtools/bnd/releases)
- [Changelog](https://github.com/bndtools/bnd/blob/master/docs/ADDING_RELEASE_DOCS.md)
- [Commits](https://github.com/bndtools/bnd/compare/6.1.0...6.2.0)

---
updated-dependencies:
- dependency-name: biz.aQute.bnd:bnd-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-28 07:40:22 -08:00
Marcono1234
81bb6d1dec
Remove gson/build.gradle (#2081)
Follow-up for be0a1f4ff7
2022-02-23 11:18:56 -08:00
Marcono1234
b5343ba96c
Add tests for enum constant toString() reading (#2080) 2022-02-21 14:53:59 -08:00
Mahmut H. Kocas
7ee3e2787f
Parsing Map<Enum,Obj> - 501 (#1950)
* Added parsing support for enum that has overridden toString() method.

* Fix a tiny formatting problem

* Fixed formatting issue

Co-authored-by: Éamonn McManus <emcmanus@google.com>
2022-02-21 13:11:43 -08:00
Marcono1234
49ddab9eeb
Add CodeQL GitHub code scanning workflow (#2076)
* Add CodeQL GitHub code scanning workflow

* Only compile main sources for code scanning

* Move test .proto  files to test sources

`annotations.proto` also seems to be only relevant for tests because the test
explicitly registers them as extensions. By default the Proto adapter does not
consider them.

* Address some code scanning findings

* Fix some more findings
2022-02-17 18:40:40 -08:00
Marcono1234
d19e9fe0af
Improve Maven build and GitHub Maven workflow (#2079)
* Fix consecutive Maven builds failing without performing `clean`

By default moditect-maven-plugin refuses to overwrite the JAR file it
generated in a previous run.

* Make GitHub Maven build workflow detect Javadoc issues
2022-02-16 12:51:08 -08:00
dependabot[bot]
a0b102c7ff
Bump maven-javadoc-plugin from 3.3.1 to 3.3.2 (#2077)
Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.3.1...maven-javadoc-plugin-3.3.2)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-javadoc-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-14 08:05:52 -08:00
Éamonn McManus
241044d709 Update CHANGELOG.md with 2.9.0 changes.
Update version numbers in documentation (2.8.9 -> 2.9.0).
2022-02-11 11:39:48 -08:00
Éamonn McManus
e58db43f57 [maven-release-plugin] prepare for next development iteration 2022-02-11 11:13:24 -08:00
Éamonn McManus
b6acf1178a [maven-release-plugin] prepare release gson-parent-2.9.0 2022-02-11 11:13:22 -08:00
Marcono1234
82fed02fba
Mention R8 FAQ in Android example (#2075) 2022-02-11 11:06:14 -08:00
Marcono1234
47dea2eefc
Improve error message when abstract class cannot be constructed (#1814) 2022-02-04 14:19:47 -08:00
Marcono1234
565b7a198e
Support EnumMap deserialization (#2071) 2022-02-04 07:20:32 -08:00
Marcono1234
e2e851c9bc
Add LazilyParsedNumber default adapter (#2060)
* Add LazilyParsedNumber default adapter

* Validate JsonWriter.value(Number) argument

* Fix incorrect JSON number pattern, extend tests
2022-01-28 11:26:28 -08:00
Marcono1234
710a76c8b8
Fix JsonReader.hasNext() returning true at end of document (#2061) 2022-01-27 15:59:50 -08:00
Marcono1234
be0a1f4ff7
Remove Gradle build support (#2063)
Build script was outdated and not actively maintained anymore.
2022-01-25 07:40:46 -08:00
dependabot[bot]
8e01b54682
Bump maven-compiler-plugin from 3.8.1 to 3.9.0 (#2055)
Bumps [maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.8.1 to 3.9.0.
- [Release notes](https://github.com/apache/maven-compiler-plugin/releases)
- [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.8.1...maven-compiler-plugin-3.9.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-compiler-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-12 19:30:26 -08:00
dependabot[bot]
4d8cab89c4
Bump maven-jar-plugin from 3.2.1 to 3.2.2 (#2056)
Bumps [maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/apache/maven-jar-plugin/releases)
- [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.2.1...maven-jar-plugin-3.2.2)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-jar-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-12 19:30:07 -08:00
Éamonn McManus
26e08fe742
Fix a mistaken use of StringBuilder('#'). (#2052) 2022-01-12 08:58:30 -08:00
Marcono1234
73216b2ad7
Add more Gson default constants to be used by GsonBuilder (#2051) 2022-01-12 07:07:55 -08:00
dependabot[bot]
ffcfb15f6c
Bump maven-jar-plugin from 3.2.0 to 3.2.1 (#2049)
Bumps [maven-jar-plugin](https://github.com/apache/maven-jar-plugin) from 3.2.0 to 3.2.1.
- [Release notes](https://github.com/apache/maven-jar-plugin/releases)
- [Commits](https://github.com/apache/maven-jar-plugin/compare/maven-jar-plugin-3.2.0...maven-jar-plugin-3.2.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-jar-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-10 14:43:49 -08:00
Marcono1234
d38e397421
Fix ObjectTest not restoring default Locale (#2050) 2022-01-10 07:18:42 -08:00
dependabot[bot]
4ec67c00a0
Bump maven-scm-provider-gitexe from 1.12.0 to 1.12.2 (#2047)
Bumps maven-scm-provider-gitexe from 1.12.0 to 1.12.2.

---
updated-dependencies:
- dependency-name: org.apache.maven.scm:maven-scm-provider-gitexe
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-03 08:48:14 -08:00
dependabot[bot]
f26525221d
Bump maven-scm-api from 1.11.3 to 1.12.2 (#2046)
Bumps [maven-scm-api](https://github.com/apache/maven-scm) from 1.11.3 to 1.12.2.
- [Release notes](https://github.com/apache/maven-scm/releases)
- [Commits](https://github.com/apache/maven-scm/compare/maven-scm-1.11.3...maven-scm-1.12.2)

---
updated-dependencies:
- dependency-name: org.apache.maven.scm:maven-scm-api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-03 08:47:50 -08:00
Marcono1234
6b96a389cc
Put module-info.class into Multi-Release JAR folder (#2013)
* Put module-info.class into Multi-Release JAR folder

Uses ModiTect to place module-info.class under Multi-Release JAR folder
`META-INF/versions/9`.

* Adjust pom.xml to drop support for Java 6

* Change doclint setting

All Javadoc errors have been solved previously; doclint can now be enabled
without causing build failures.

* Improve README Java requirements
2022-01-01 12:44:39 -08:00
Marcono1234
dc28951fa7
Change target Java version to 7 (#2043)
* Change target Java version to 7

* Document Gson requirements

* Add package-info.java for `stream` package
2021-12-31 07:20:29 -08:00
dependabot[bot]
bc8858a3d9
Bump maven-deploy-plugin from 3.0.0-M1 to 3.0.0-M2 (#2044)
Bumps [maven-deploy-plugin](https://github.com/apache/maven-deploy-plugin) from 3.0.0-M1 to 3.0.0-M2.
- [Release notes](https://github.com/apache/maven-deploy-plugin/releases)
- [Commits](https://github.com/apache/maven-deploy-plugin/compare/maven-deploy-plugin-3.0.0-M1...maven-deploy-plugin-3.0.0-M2)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-deploy-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-12-31 07:15:38 -08:00