Degubi
c5a3f21fba
Refactor JsonParser to statics & fix tests
2019-04-15 22:35:10 -04:00
Degubi
477b3f77e1
Refactor primitives class
2019-04-15 11:08:31 -04:00
Degubi
46d0f58d12
Remove unnecessary explicit else statement
2019-04-05 16:20:06 +02:00
Degubi
3ee3c150ed
Remove boolean wrappers in JsonElement
2019-03-31 21:28:12 +02:00
Degubi
fc63a6af4c
Make sql module dependency transitive ( #1500 )
2019-03-29 09:34:12 -07:00
Manuel Kollus
5370b076e3
Removing 'final' accessor from constructor ( #1501 )
2019-03-28 09:22:36 -07:00
Degubi
8bf2949c29
Remove object based constructors, remove some internal stuff
2019-03-11 10:53:31 -04:00
Degubi
bac26b8e42
Optimize array copies
2019-03-05 12:12:04 -05:00
Lorenz Nickel
b75e1bbc79
Code cleanup (Removed spaces) ( #1474 )
...
* Removed double spaces in comments
* Unified comments
* Removed space
* Removed spaces in code
2019-03-03 11:18:06 -08:00
Márton Braun
4d942db168
Update Gson.java documentation to explicitly state behavior for empty strings ( #1464 )
2019-02-17 00:32:43 -08:00
Piet van Dongen
5bbc768fa6
Fix JPMS module setup ( fixes #1315 ) ( #1402 )
...
* Fix JPMS module setup (fixes #1315 )
* Re-added cause to AssertionErrors
2018-10-18 08:49:08 -07:00
Mike Cumings
69f7c4e243
Replace instance equality checks in $Gson$Types#resolve
2018-09-26 22:38:53 -07:00
Mike Cumings
e2296f42d5
Fix issue with recursive type variable protections to fix #1390
...
When a type variable is referenced multiple times it needs to resolve
to the same value. Previously, the second attempt would abort
resolution early in order to protect against infinite recursion.
2018-09-25 16:09:48 -07:00
Eric Cochran
92b6173791
Deprecate JsonElement.getAsCharacter
2018-07-30 13:44:21 -04:00
joel-leitch
4c685b21a8
Private constructor ( #1324 )
...
* Adding private constructors on Util classes
* Remove obsolete step
2018-05-21 20:04:22 -07:00
inder123
d84e26d80c
Issue 1242: Printing Gson version when throwing AssertionError and IllegalArgumentException ( #1321 )
...
On some versions of Android (probably on some variants of the popular Samsung S4 phone), an older version of Gson is suspected to be bundled in, and gets picked up from the system classpath.
For those versions, the applications that include the latest Gson fail unexpectedly. This debug print will help confirm this issue.
2018-05-17 09:41:21 -07:00
inder123
a6890bbaba
Fixed https://github.com/google/gson/issues/1310 ( #1311 )
...
* Fixed https://github.com/google/gson/issues/1310
Also renamed VersionUtils to more readable abstraction JavaVersion
Added support for debian naming convention
Using min supported version (6) as the default if JDK version can't be figured out
* Moved JavaVersion to an internal package
2018-05-09 13:10:08 -07:00
inder123
049bf84e68
Using sun.misc.Unsafe only through reflection to avoid binary dependency ( #1306 )
...
If sun.misc.Unsafe not found on Java 9, try field.setAccessible
Also removed exception traces when sun.misc.Unsafe or override are not found
2018-05-01 09:57:45 -07:00
Leon
ab35f11077
add FieldNamingPolicy.LOWER_CASE_WITH_DOTS ( #1278 )
2018-04-27 18:50:08 -07:00
Lyubomyr Shaydariv
bdea5b9e99
Removed the executable flag from clearly text files
2018-04-26 10:23:15 +03:00
Andrey Mogilev
8445689e4d
Java 9 support: use Unsafe-based reflection in Java 9+ ( #1218 )
...
* Java 9 support: use Unsafe-based reflection in Java 9+
fixes "illegal reflective access" warnings and exceptions
* fix Codacy warnings
* improve code quality based on PR review
* improve code quality based on PR review
* fix Codacy warning
* improve code quality based on PR review
* inlined createReflectionAccessor method
2018-01-04 00:38:50 +05:30
Andrey Mogilev
0aaf5ff408
fix Java9 DateFormat changes ( #1211 )
...
* fix Java9 DateFormat changes
* fix Codacy warnings
2017-12-30 00:44:43 +05:30
Anirudh Ramanan
3bf1967c0a
Optimised the create() call for Excluder TypeAdapterFactory ( #1199 )
...
* optimized the create() method, excludeClass used to get called two times, changed it to one
* fixed the create() method, and added support to disableAnonymousAndLocalClassSerialization
* peek only once
* enable anonymous and local class serialization
* bugfix
* removed the method, will raise it as a separate PR
2017-12-28 06:03:45 +05:30
michaelsavich
7ddac52748
Java 9 module ( #1179 )
...
* Add module-info.java
* Exclude module-info.java by default
2017-12-26 21:58:19 +05:30
Trung Do
855f0493d0
Fix a small typo ( #1183 )
2017-10-31 11:43:24 -07:00
Andrey Mogilev
b1fb9ca9a1
fix issue #1107 : resolve element type in wildcard collection types ( #1146 )
...
* fix issue #1107 : resolve element type in wildcard collection types
* fix Codacy warnings
* fix Codacy warnings
2017-09-21 17:50:41 -07: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
Nels Beckman
ddcd6aea7d
Update fromJson Javadoc. ( #1151 )
...
For the string-based fromJson() method, mention that the result will be null if the given string is empty.
2017-09-18 00:08:22 -07:00
Lyubomyr Shaydariv
7a9fd5962d
Fixed DefaultDateTypeAdapter nullability issue and JSON primitives contract ( #1100 )
...
* Fixed DefaultDateTypeAdapter nullability issue and JSON primitives contract
Regression in:
* b8f616c939
- Migrate DefaultDateTypeAdapter to streaming adapter (#1070 )
Bug reports:
* https://github.com/google/gson/issues/1096 - 2.8.1 can't serialize and deserialize date null (2.8.0 works fine)
* https://github.com/google/gson/issues/1098 - Gson 2.8.1 DefaultDateTypeAdapter is not null safe.
* Fixed DefaultDateTypeAdapter nullability on write
2017-09-17 23:49:13 -07:00
Warren Smith
d9cc7bc60b
Make GsonBuilder.create() factory order idempotent. ( #1141 )
2017-08-14 08:56:16 -07:00
Tom Magnusson
68cf8fdc95
fix typo in ConstructorConstructor exception
2017-08-03 09:28:31 -04:00
Andrey Mogilev
03a72e752e
Fix StackOverflowError on resolving types with TypeVariable recursion ( #1128 )
...
* Fix StackOverflowError on resolving types with TypeVariable recursion
Sample failing code:
private static class TestType<X> {
TestType<? super X> superType;
}
...
new Gson().getAdapter(TestType.class);
* fix build errors
2017-07-31 10:50:29 -07:00
Igor Mysak
ee691fba43
fix javaDoc ( #1122 )
2017-07-21 10:12:25 -07:00
inder123
3090a7ed2a
Made deepCopy public ( #1091 )
...
* Made deepCopy public
* since 2.8.2
2017-05-31 10:33:37 -07:00
Mike
ada597e69a
value(double) can write NaN and infinite values when lenient, as value(Number) does ( #1093 )
...
* Added test which shows that lenient JsonWriter fails writing infinite primitive doubles, but does not fail writing boxed doubles, as stated in #1090 .
* Fixed JsonWriter#value(double) to write infinite and NaN values when lenient, as JsonWriter#value(Number) does. (fixes #1090 )
2017-05-31 09:50:44 -07:00
Lyubomyr Shaydariv
b8f616c939
Migrate DefaultDateTypeAdapter to streaming adapter ( #1070 )
2017-05-30 18:12:50 -07:00
Andrey Mogilev
a300148003
Fix StackOverflowError on resolving recursive types by collapsing chains of type bounds ( #1075 )
...
* Fixes StackOverflowError on resolving recursive types.
See Issue #440 , Issue #603 , tests.
* fix 'codacy' coding style warnings
* added copyright header
2017-05-30 17:47:04 -07:00
sourabh gupta
5848096f3e
Size allocation of StringBuilder ( #1047 )
...
Size allocation of StringBuilder
2017-05-24 15:49:09 -07:00
Eric Cochran
3270e8d972
Remove need for synthetic accessor methods.
2017-04-22 17:32:59 -07:00
inder123
5412f21431
Printing more debugging information to help track an invalid JsonAdapter. ( #1068 )
...
Now the thrown exception carries this information:
java.lang.IllegalArgumentException: Invalid attempt to bind an instance of java.lang.Integer as a @JsonAdapter for com.google.gson.functional.JsonAdapterAnnotationOnClassesTest$D. @JsonAdapter value must be a TypeAdapter, TypeAdapterFactory, JsonSerializer or JsonDeserializer.
2017-04-19 17:08:21 -07:00
Michele Vivoda
9a2421997e
negative zero test and fix ( #1069 )
2017-04-19 14:26:36 -07:00
Mohammad Yasir
92b52d25d8
Performance fix to avoid reflection-based initialization of null key surrogate
2017-04-12 16:11:20 -04:00
sourabh gupta
441fa98735
Simplified access of getSimpleName ( #1042 )
...
* Simplified access of getSimpleName
instead of calling getClass.getSimpleName() that will check too many conditions inside , we can make it as final String and use it directly.
* Simplified access of getSimpleName
making string as static
* Simplified access of getSimpleName
Code Review changes
2017-03-20 14:25:52 -07:00
Jesse Wilson
423ff04a75
Merge pull request #1037 from guptasourabh/master
...
elimiating code overhead
2017-03-18 15:34:09 -04:00
guptasourabh
8101ab74e9
list addition optimization ( #1038 )
...
* list addition optimization
* Optimized imports
Optimized imports
2017-03-16 21:16:38 -07:00
Sourabh Gupta
d0e70bcdbf
elimiating code overhead
2017-03-15 22:41:42 +05:30
guptasourabh
fd37cf1d0d
JsonArray with capacity in constructor ( #1033 )
...
JsonArray with capacity in constructor
2017-03-12 19:59:41 -07:00
Anirudh Ramanan
9e44d60b83
Eliminating code overhead
...
* calculating size of the list once in case of loops, avoided creation of string builder object if the length type argument is 0
* replaced null check boilerplate code with nullSafe()
2017-03-01 11:13:56 -05:00
Mohammad Yasir
4644837207
Incorporating the review comments. While more than 1 charachter might be read from the buffer the output will have only one escaped charachter.
2017-02-17 11:54:30 +05:30
Jesse Wilson
2d072bae3a
Merge pull request #1015 from yasirmhd/master
...
Memory optimisation in JsonReader
2017-02-16 22:58:16 -05:00
Mohammad Yasir
9c30b0e203
Incorporating code review suggestions
2017-02-17 07:25:23 +05:30
André Rouél
9e6f2bab20
Fix ArrayIndexOutOfBoundsException when skipping a value with JsonTreeReader #1013 ( #1014 )
2017-02-15 18:41:39 -08:00
Mohammad Yasir
ba4643134a
Removing unused variable
2017-02-16 03:00:02 +05:30
Mohammad Yasir
410b4a8c62
Optimizing for memory
2017-02-16 02:51:02 +05:30
BloodShura
9d8d7a43e1
All JsonElement::getAsJsonXXX methods now include the JSON string on thrown exception's message
2017-02-07 22:04:22 -02:00
Yutaro Iino
9e5e4ac630
Add missing comma in toString()
2016-12-21 00:10:42 +09:00
Mark Hess
4976e420fc
Add keySet method and test ( #942 )
2016-12-13 22:15:49 -08:00
Kevin Most
5f73666404
Update JsonAdapter documentation ( #976 )
...
Include mention of JsonDeserializer and JsonSerializer.
2016-12-11 22:37:55 -08:00
Egor Neliuba
44cad04a63
Allow deserialization of a Number represented as a String ( #964 )
2016-11-25 23:40:14 -08:00
Inderjeet Singh
688f918a35
Added @Documented to Gson annotations.
...
This is useful since it shows the JSON format for a class which the user of that class should typically know.
2016-09-15 18:24:21 -07:00
Jake Wharton
9414b9b3b6
Add static factories for array and parameterized type tokens.
...
These are useful when creating TypeAdapterFactories that delegate to others with more complex types. They also are useful when writing dynamic code that deals with types that cannot be fully reified using the normal subclass technique.
2016-08-12 12:11:57 -04:00
testcenter
193349f4aa
made nullSafe wrapper of JsonAdapter optional
2016-06-28 09:18:03 +02:00
inder123
b2c00a3b02
Merge pull request #873 from google/jwilson.0601.get_delegate_adapter
...
Add support for JsonSerializer/JsonDeserializer in the JsonAdapter annotation
2016-06-14 16:37:14 -07:00
Inderjeet Singh
1f859ec769
addressed code review comments.
2016-06-14 16:34:34 -07:00
Jesse Wilson
c24af30407
Merge pull request #871 from google/jw/tree-json-path
...
Implement JSON Path for JsonTreeReader.
2016-06-09 23:32:24 -07:00
Jake Wharton
c16be41e77
Expose JsonObject size.
2016-06-10 00:46:32 -04:00
Jake Wharton
c2fae85a9f
Implement JSON Path for JsonTreeReader.
2016-06-10 00:14:28 -04:00
inder123
ebad966efd
Merge pull request #870 from google/jw/reader-location
...
Consolidate location and path rendering for exceptions.
2016-06-09 15:26:10 -07:00
Jake Wharton
ecaa57114f
Consolidate location and path rendering for exceptions.
2016-06-09 18:02:36 -04:00
Archit Dey
3f8726ecaf
Enhancing the json reader, adding corresponding test case for it
2016-06-02 09:19:43 -04:00
jwilson
2df65502ed
Don't use ThreadLocals for @JsonAdapter factories and getDelegateAdapter().
2016-06-02 00:33:09 -04:00
Inderjeet Singh
943c674276
Removed ThreadLocal for activeJsonAdapterClasses
2016-06-02 00:08:25 -04:00
Inderjeet Singh
45511fdd15
Added support for JsonSerializer/JsonDeserializer for JsonAdapter annotation.
...
JsonAdapter is cached per the type of the JsonAdapter class.
Added a test to ensure JsonAdapter works on fields of parameterized types
Keep track of registered JsonAdapters and JsonAdapterFactorys in ThreadLocal.
2016-06-02 00:08:25 -04:00
Jesse Wilson
bb451eac43
Merge pull request #832 from google/831
...
Ensuring that JsonAdapter annotation works correctly for primitive fi…
2016-05-17 17:26:52 -04:00
Inderjeet Singh
3ff16c30db
Don't use a runtime wrapper if a JsonAdapter annotation is present on a field.
...
This ensures that JsonAdapter annotation works correctly on a primitive field.
This is a potentially backward incompatible change.
2016-05-17 13:30:59 -07:00
Inderjeet Singh
61f83d6309
Replaced a JDK 1.7 specific method with its JDK 1.6 equivalent.
2016-05-17 01:03:00 -07:00
Baschdl
c414b368e1
Corrected documentation, copy&paste error
2016-05-12 14:47:03 +02:00
Jake Wharton
371aff7ce4
Switch default Queue implementation to ArrayDeque.
...
Now that we require Java 1.6 or newer this much more efficient implementation can be used as the default.
2016-04-27 00:37:28 -04:00
Jake Wharton
8537c8932f
Optimize list allocation for every reflective field.
...
The common cases (no @SerializedName and a single-value @SerializedName) now use a specialized one-element collection. Cases with alternate names use a much more space efficient ArrayList which is exactly sized.
This is also a performance win for adapter initialization since an index-based loop was used on the returned type for which LinkedList is not suited for.
2016-04-27 00:28:51 -04:00
Ryan Harter
a851569ab9
Adds getters for config fields.
...
This adds simple getters for certain config fields that would be helpful in custom
TypeAdapters to deal with situations like this:
https://github.com/rharter/auto-value-gson/issues/18
2016-04-26 15:30:01 -04:00
Jake Wharton
59edfc1caf
Add boxed boolean value() overload.
...
When calling value() with a Boolean overload resolution would choose value(boolean) which would throw an NPE on null. The other boxed types are all numbers which would resolve to value(Number) and behave correctly.
2016-04-22 19:52:38 -04:00
Jesse Wilson
0f66f4fac4
Merge pull request #829 from ionspin/master
...
Check if class can be instantiated based on class modifiers. Fix for #817
2016-04-22 06:47:08 -10:00
Ugljesa Jovanovic
ab40462cc7
Check if class can be instantiated based on class modifiers. If not throw an unsupported operation exception.
2016-04-20 10:43:34 +02:00
gavlyukovskiy
966de9e60d
fixed throwing RuntimeException instead of JsonIOException
2016-04-15 21:00:59 +03:00
Scott Brown
9c4f352320
minor javadoc fix ... @code block not treated as html
2016-04-08 19:34:05 -06: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
Scott Brown
0669ff7fd1
allow unquoted long and integer keys
2016-03-12 11:52:13 -07:00
qwwdfsad
31dcfa3ad6
More appropriate usage of null key surrogate in Gson#getAdapter for backward compatibility
2016-03-05 02:08:26 +03:00
qwwdfsad
c5611847a3
Gson synchronized map replaced with concurrent hash map
2016-03-05 00:28:25 +03:00
Inderjeet Singh
c731abb293
Fixed a regression in Gson 2.6 where Gson caused NPE if the TypeAdapterFactory.create() returned null.
2016-02-25 13:56:42 -08:00
Dongjoon Hyun
aa209fa255
Fix some typos in gson comments.
2016-02-15 14:11:23 -08:00
inder123
8383f5c7fa
Merge pull request #769 from paniko0/master
...
timezones without minutes should be valid according RFC3339
2016-02-02 20:23:52 -08:00
Jake Wharton
c8627c8ab8
Update reader and writer for RFC 7159.
2016-01-18 15:07:33 -05:00
inder123
2ab776b5f5
Merge pull request #771 from google/jw/global-leniency
...
Add setting for leniency on Gson instance.
2016-01-18 14:03:23 -05: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
Jerzy Chalupski
23e2916947
Make TypeAdapters created by @JsonAdapter null-safe
2016-01-18 16:41:07 +01:00
Psidium
61f58baaf9
fix typo in JsonArray docs
2016-01-12 11:02:42 -02:00
Danillo Souza
ed6298c98a
timezones without minutes should are valid according RFC3339
2016-01-11 15:33:55 -02:00
inder123
1f803bd37d
Merge pull request #761 from google/jw/nuke-synthetics
...
Remove synthetic accessors from being generated.
2015-12-27 14:08:23 -05:00
Jake Wharton
7a1c94f986
Remove synthetic accessors from being generated.
2015-12-27 01:39:19 -05:00