YOUNG CHA
94f894cf44
Add testcase for obfuscated enum class
2021-08-04 12:02:50 +09:00
Éamonn McManus
63e747f7f4
Merge pull request #1712 from rhernandez35/master
...
Fix fallback behavior of UnsafeReflectionAllocator when AccessibleObject isn't so accessible
2021-08-03 17:27:54 -07:00
Éamonn McManus
425cb25549
Adjust some minor details of #1391 .
...
Use two-space indentation for the new test.
Use standard Google import style.
Supply missing type argument for `TypeVariable`.
2021-08-02 17:33:10 -07:00
Éamonn McManus
d65960b001
Merge pull request #1391 from mcumings/issue1390
...
Fix issue with recursive type variable protections to fix #1390
2021-08-02 16:43:19 -07:00
Richard Hernandez
b39494dbe6
Fix fallback behavior of UnsafeReflectionAllocator when AccessibleObject isn't so accessible
2020-05-26 20:12:36 -07:00
Marcono1234
9171715a88
Fix ISO8601UtilsTest failing on systems with UTC+X
...
Previously ISO8601UtilsTest.testDateFormatString() would fail on systems
where the time zone is UTC+X because getTime() returned "2018-06-24" for them.
Additionally the tests which previously changed the system locale and time
zone have been rewritten to create a UTC calendar instead. Setting locale
seems to not be necessary because ISO8601Utils.parse(...) does not do that
either.
2020-05-03 00:35:47 +02:00
Jiechuan Chen
4d735f1903
Add new testcases ( #1638 )
...
* Json Primitive Tests
* Json Tree Writer tests
* Add Tests for ISO8601Utils
* Add Tests for ISO8601Utils
2020-02-17 14:55:19 -08:00
Paul Kassianik
21fc362a7e
Fixed tests for java 11 ( #1454 )
2019-10-04 11:29:13 -07:00
Degubi
7845c38077
Minor cleanups in deprecations and other warnings ( #1522 )
2019-10-03 15:49:24 -07:00
Degubi
63ee47cb64
Refactor uppercaseFirstLetter, add additional field to test ( #1515 )
2019-04-26 15:49:22 -07:00
Degubi
c5a3f21fba
Refactor JsonParser to statics & fix tests
2019-04-15 22:35:10 -04:00
Jake Wharton
a817604a41
Add test coverage for passing null to JsonPrimitive constuctors
2019-03-11 10:50:22 -04: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
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
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
inder123
1b28ff3cda
Added a test for deserialization of fields using lowercase-dot naming policy ( #1303 )
2018-04-27 18:54:48 -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
Inderjeet Singh
4081dbaa6d
Added a test for serialization/deserialization of enum classes with
...
fields
2018-03-17 16:00:46 -07:00
Andrey Mogilev
0aaf5ff408
fix Java9 DateFormat changes ( #1211 )
...
* fix Java9 DateFormat changes
* fix Codacy warnings
2017-12-30 00:44:43 +05:30
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
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
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
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
Lyubomyr Shaydariv
eb27d55f49
Remove helper methods mentioned in the TODO list
2017-04-23 15:54:10 +03: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
André Rouél
9e6f2bab20
Fix ArrayIndexOutOfBoundsException when skipping a value with JsonTreeReader #1013 ( #1014 )
2017-02-15 18:41:39 -08:00
Mark Hess
4976e420fc
Add keySet method and test ( #942 )
2016-12-13 22:15:49 -08:00
Egor Neliuba
44cad04a63
Allow deserialization of a Number represented as a String ( #964 )
2016-11-25 23:40:14 -08: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
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
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
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
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
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
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
Scott Brown
0669ff7fd1
allow unquoted long and integer keys
2016-03-12 11:52:13 -07:00
Inderjeet Singh
1ab73ffd21
incorporated code review feedback by eliminating the stringified type adapter.
2016-02-26 09:25:23 -08:00