9409197165
Merge remote-tracking branch 'origin/master'
...
# Conflicts:
# gson/src/main/java/com/google/gson/stream/JsonReader.java
# gson/src/test/java/com/google/gson/functional/ReflectionAccessFilterTest.java
# gson/src/test/java/com/google/gson/functional/ReflectionAccessTest.java
# gson/src/test/java/com/google/gson/internal/bind/DefaultDateTypeAdapterTest.java
# pom.xml
2022-10-31 12:44:34 +01:00
Marcono1234
e614e71ee4
Clarify in documentation that Gson might cache strategy results ( #2215 )
...
* Clarify in documentation that Gson might cache strategy results
* Improve wording; mention that adapter factory results are cached as well
2022-10-04 09:01:55 -07:00
Marcono1234
796193d032
Improve versioning support documentation and validate version ( #2214 )
2022-10-02 16:38:43 -07:00
Marcono1234
28609089fa
Add Javadoc since tags for previously added elements ( #2211 )
2022-10-01 15:58:26 -07:00
BillyGalbreath
47668fad57
Fix typo in GsonBuilder Javadoc ( #2213 )
2022-10-01 15:57:16 -07:00
Éamonn McManus
0864a02e86
Build on JDK 17 as well as 11. ( #2198 )
...
* Build on JDK 8 and 17 as well as 11.
* Remove JDK 8 for now.
`DefaultDateTypeAdapterTest` fails.
* Tweak javadoc to avoid warnings.
Mostly these are about using `<h3>` when the previous tag was `<h1>`,
and the like. This previous tag might be implicit (part of what javadoc
itself outputs rather than the HTML in doc comments).
Apparently JDK 11 puts method javadoc inside `<h2>` while JDK 11 puts it
inside `<h3>`. Or something like that. Anyway it doesn't appear to be
possible to use `<h3>` _or_ `<h4>` and please both.
2022-09-23 14:33:28 -07:00
ce02cb3bc1
Merge remote-tracking branch 'origin/master'
...
# Conflicts:
# gson/pom.xml
# gson/src/main/java/com/google/gson/Gson.java
# gson/src/main/java/com/google/gson/GsonBuilder.java
# gson/src/main/java/com/google/gson/internal/bind/ArrayTypeAdapter.java
# gson/src/main/java/com/google/gson/stream/JsonWriter.java
# gson/src/test/java/com/google/gson/functional/ArrayTest.java
# gson/src/test/java/com/google/gson/functional/MapTest.java
# pom.xml
2022-09-14 19:20:24 +02:00
Marcono1234
847d7f6638
Improve documentation ( #2193 )
...
* Improve JsonElement subclasses javadoc and add tests
* Slightly improve JsonSerializer and JsonDeserializer javadoc
* Improve ReflectionAccessTest failure message
* Improve documentation regarding field and class exclusion
2022-09-09 07:32:55 -07:00
Marcono1234
f7a164d98b
Fail Maven build on compiler warnings; remove some warning suppressions ( #2183 )
...
* Fail Maven build on compiler warnings; remove some warning suppressions
* Fix compiler warnings causing failure for newer JDK
* Improve placement of "raw" and "unchecked" warning suppressions
* Adjust javac documentation link
* Fix compilation error on newer JDKs
2022-08-26 17:36:18 -07:00
Marcono1234
7f77ad4ff6
Replace $Gson$Preconditions.checkNotNull
with Objects.requireNonNull
( #2180 )
...
* Replace $Gson$Preconditions.checkNotNull with Objects.requireNonNull
* Add back checkNotNull
2022-08-22 07:22:32 -07:00
Marcono1234
b0b6834157
Mention that GsonBuilder.registerTypeAdapter makes (de-)serializers null-safe ( #1704 )
2022-08-22 06:55:31 -07:00
Marcono1234
b84b2218f2
Add null checks for GsonBuilder methods ( #2179 )
2022-08-20 13:16:35 -07:00
Marcono1234
390385e382
Clarify that GsonBuilder.setExclusionStrategies
does not replace existing ones ( #2168 )
...
* Clarify that `GsonBuilder.setExclusionStrategies` does not replace existing ones
* Fix punctuation
2022-08-06 10:01:37 -07:00
Marcono1234
cbc0af867b
Improve lenient mode documentation ( #2122 )
2022-06-28 09:48:05 -07:00
dc4e61ac7b
Several breaking changes
2022-05-17 21:20:10 +02:00
9d7fd891ee
Merge branch 'allow_duplicate_map_key'
...
# Conflicts:
# gson/src/main/java/com/google/gson/GsonBuilder.java
# gson/src/test/java/com/google/gson/GsonTest.java
2022-05-12 22:54:17 +02: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
Marcono1234
73216b2ad7
Add more Gson
default constants to be used by GsonBuilder
( #2051 )
2022-01-12 07:07:55 -08:00
Marcono1234
615c8835d3
Add GsonBuilder.disableJdkUnsafe()
( #1904 )
...
* Add GsonBuilder.disableJdkUnsafe()
* Address review feedback
2021-12-30 15:08:18 -08:00
Marcono1234
6ffcdf3029
Fix Javadoc warnings and errors ( #2040 )
2021-12-26 15:30:21 -08:00
Marcono1234
bda2e3d16a
Improve number strategy implementation ( #1987 )
...
* Fix GsonBuilder not copying number strategies from Gson
* Improve ToNumberPolicy exception messages
2021-10-11 16:14:47 -07:00
Lyubomyr Shaydariv
fe30b85224
Support arbitrary Number implementation for Object and Number deserialization ( #1290 )
...
* Object and Number type adapters number deserialization can be configured
* Change wording of ToNumberStrategy documentation
* Use inline links in doc sparingly
If the element has already been linked before, don't create a link for
every subsequent occurrence.
See also (slightly dated)
https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html#inlinelinks
* Link to default to-number policies in ToNumberStrategy doc
* Reduce code duplication for deserializing Number
* Hide default factory constants of NumberTypeAdapter and ObjectTypeAdapter
This encapsulates the logic a little bit better.
Additionally refactored factory created by NumberTypeAdapter to only create
TypeAdapter once and then have factory reuse that adapter for better
performance.
Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
2021-10-08 17:09:43 -07:00
tiegen
9cf569698c
Update gson/src/main/java/com/google/gson/GsonBuilder.java
...
Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
2021-04-26 10:36:30 +08:00
tiegen
527c6cf0d0
Update gson/src/main/java/com/google/gson/GsonBuilder.java
...
Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
2021-04-26 10:36:02 +08:00
tiegen
ccf8484915
Update gson/src/main/java/com/google/gson/GsonBuilder.java
...
Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
2021-04-25 16:34:04 +08:00
tiegen
897452a3cf
Update gson/src/main/java/com/google/gson/GsonBuilder.java
...
Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
2021-04-25 16:33:42 +08:00
tiegen
08765cae4c
Update gson/src/main/java/com/google/gson/GsonBuilder.java
...
Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
2021-04-25 16:33:36 +08:00
saddays
a0ea108c59
allow deserialize duplicate map key
2021-04-21 14:39:45 +08:00
Marcono1234
380c4ec12c
Make dependency on java.sql optional
2020-05-23 23:30:53 +02:00
Marcono1234
541252a9fb
Implement DefaultDateTypeAdapter in a type safer way
2020-05-09 17:34:52 +02:00
Warren Smith
08bbb226f1
Add newBuilder() API ( #1142 )
...
* Add Gson.newBuilder API.
* Remove redundant test.
* Address Codacy comments.
* Reduce visibility of GsonBuilder constructor.
2017-09-20 18:53:10 -07:00
Warren Smith
d9cc7bc60b
Make GsonBuilder.create() factory order idempotent. ( #1141 )
2017-08-14 08:56:16 -07:00
Lyubomyr Shaydariv
b8f616c939
Migrate DefaultDateTypeAdapter to streaming adapter ( #1070 )
2017-05-30 18:12:50 -07:00
guptasourabh
8101ab74e9
list addition optimization ( #1038 )
...
* list addition optimization
* Optimized imports
Optimized imports
2017-03-16 21:16:38 -07:00
Inderjeet Singh
34d7521d95
moved the JsonSerializationContext/JsonDeserializationContext fields to where they are used.
...
Also moved TreeTypeAdapter to internal.bind package for potential use in JsonAdapterAnnotationFactory.
2016-03-28 14:46:02 -07:00
Dongjoon Hyun
aa209fa255
Fix some typos in gson comments.
2016-02-15 14:11:23 -08:00
Jake Wharton
3360c93a76
Add setting for leniency on Gson instance.
...
Add a JsonReader factory (for parity with the JsonWriter one) which provides a configured instance using the Gson settings.
2016-01-18 12:08:11 -05:00
Jesse Wilson
dc4e43bb23
Permit users to define type adapters for primitive types and strings.
...
Also expose an API to get the field naming strategy.
2012-06-30 02:37:49 +00:00
Jesse Wilson
3df2db1f16
Don't permit a type adapter for String to be registered.
2012-04-12 18:27:48 +00:00
Inderjeet Singh
498049b304
updated documentation for registerTypeHierarchyAdapter to cover TypeAdapter.
2011-12-31 06:00:28 +00:00
Inderjeet Singh
46d2d79ba7
Added javadocs for type adapter registration through registerTypeAdapter method.
2011-12-31 05:32:14 +00:00
Jesse Wilson
d7fbac0384
Rename TypeAdapter.Factory to TypeAdapterFactory.
2011-12-23 18:27:13 +00:00
Jesse Wilson
e2e672740a
Fix broken test in registering competing type hierarchy adapters.
...
I actually tried to replicate this test but got an error "type adapters conflict" when I was doing it. I suspect the problem was that I was trying to use 'Object' as the base of my type hierarchy and that class is somehow special.
2011-12-06 15:29:48 +00:00
Jesse Wilson
d5ed0716db
Fix type adapter precedence so that last-registered wins (except for tree type hierarchy adapters, which were always last).
2011-12-06 05:09:18 +00:00
Jesse Wilson
8f8e69a364
Add @since tags.
2011-12-02 23:11:28 +00:00
Inderjeet Singh
2da01fb183
Deleted deepCopy as GsonBuilder should not be designed as a reusable object.
2011-11-29 07:58:32 +00:00
Inderjeet Singh
ddde79c861
Added a deepCopy() method in GsonBuilder. This allows a web-service to create a pre-configured GsonBuilder and then for each request, create a Gson instance by adding type adapters to a copy.
...
In TypeAdapter.Factory.create() method, using the term gson to refer to the Gson instance instead of a little ambiguous context.
2011-11-25 05:40:17 +00:00
Jesse Wilson
9a80d095d9
Fix a regression I introduced with the changes to type hierarchy registration. If the registered type was a raw type, we need to also match the parameterizations of that type.
2011-11-23 13:38:25 +00:00
Inderjeet Singh
1c09e24220
inlined typeAdapter and typeHierarchyAdapter methods. Added some documentation for registerTypeHierarchyAdapterFactory.
2011-11-23 09:26:44 +00:00