Commit Graph

12 Commits

Author SHA1 Message Date
Maicol be87c3fd0e
Port Junit test to Truth in the package `com.google.gson` of the module `gson` (#2299)
* Add the Truth dependency

* Port Junit test to Truth in the package `com.google.gson` of the module `gson`

* Replace the `assertThat(e.getMessage()).isEqualTo(...)"` with `assertThat(e).hasMessageThat().isEqualTo(...)`

* Minor fixes
2023-01-17 07:59:10 -08:00
Maicol 1a2170b99c
Port tests from JUnit 3 to JUnit 4 (#2294)
* Port tests from JUnit 3 to JUnit 4

* Port tests from JUnit 3 to JUnit 4

* Add `@Test` above `@Ignore`
2022-12-22 06:04:16 -08:00
Marcono1234 2d01d6a20f
Make `Object` and `JsonElement` deserialization iterative (#1912)
* Make Object and JsonElement deserialization iterative

Often when Object and JsonElement are deserialized the format of the JSON
data is unknown and it might come from an untrusted source. To avoid a
StackOverflowError from maliciously crafted JSON, deserialize Object and
JsonElement iteratively instead of recursively.

Concept based on 51fd2faab7
But implementation is not based on it.

* Improve imports grouping

* Address review feedback
2022-06-22 17:42:19 -07:00
Marcono1234 4dda4ec5ba
Use diamond operator when creating generic instances (#2104) 2022-04-17 15:27:21 -07:00
Jesse Wilson 751c69c655 Support null values in StringMap 2012-03-11 15:19:01 +00:00
Jesse Wilson 323dfa0af5 Be strict in TypeAdapter's toJson/fromJson methods 2012-01-01 12:36:42 +00:00
Inderjeet Singh 756131d869 removed Eclipse 3.7 warnings. 2011-12-04 10:24:07 +00:00
Jesse Wilson 7e760143fd Smash together MiniGson and Gson. This changes Gson to be the MiniGson rather than delegating to the MiniGson. It means that the MiniGson objects passed into streaming type adapters are now fully-capable 'Gson' objects.
The most notable impact of this change is that it adds several new public APIs:
 - The TypeAdapter abstract class
 - The TypeAdapter.Factory interface
 - Four new methods on GsonBuilder to register streaming TypeAdapters (via Factory, via Class, via TypeToken, and as a type hierarchy)
 - Three new methods on Gson to lookup streaming TypeAdapters (by type, by class, and to get the next type adapter) 

Still outstanding:
 - Write beautiful prose to document the new APIs above
 - Change GsonBuilder's precedence so that both old and new-style type adapters are registered in one lot
2011-11-20 15:23:08 +00:00
Inderjeet Singh 31964507c1 Updated SuppressWarnings annotations to Eclipse 3.6/3.7 which is unfortunately incompatible with Eclipse 3.5 (rawtypes vs unchecked)
This CL eliminates all eclipse warnings.
2011-10-20 21:32:46 +00:00
Inderjeet Singh 2780a2a9bf Fixed eclipse warnings. 2011-09-16 06:03:16 +00:00
Jesse Wilson f67940cb63 Retire two old bad features
- overriding primitive type adapters
 - auto unwrapping of single element arrays
2011-09-09 04:20:25 +00:00
Jesse Wilson 3aeb70e030 Adapter for Object.class 2011-09-09 03:31:16 +00:00