Commit Graph

52 Commits

Author SHA1 Message Date
Marcono1234 4dda4ec5ba
Use diamond operator when creating generic instances (#2104) 2022-04-17 15:27:21 -07: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
Degubi 7845c38077 Minor cleanups in deprecations and other warnings (#1522) 2019-10-03 15:49:24 -07:00
Degubi c5a3f21fba Refactor JsonParser to statics & fix tests 2019-04-15 22:35:10 -04:00
Lyubomyr Shaydariv bdea5b9e99 Removed the executable flag from clearly text files 2018-04-26 10:23:15 +03:00
Scott Brown 0669ff7fd1 allow unquoted long and integer keys 2016-03-12 11:52:13 -07:00
Inderjeet Singh fef43b2aaa Added support to serialize/deserialize ConcurrentMap and ConcurrentNavigableMap. 2015-11-04 21:25:15 -08:00
Joel Leitch 5af92f1736 Additional changes to a map test with "null" string key. 2013-01-14 22:18:07 +00:00
Joel Leitch 14f16e2d0c Adding Red-Black Tree implementation and tying it into the Gson bindings. 2012-10-11 03:15:49 +00:00
Jesse Wilson 7b61e784c0 Remove testParameterizedMapSubclassDeserialization that never passed. We'll eventually add an equivalent to the extras/ package. 2012-04-12 18:15:56 +00:00
Inderjeet Singh 15c2ae7548 Updated map subclass deserialization test to illustrate a failing condition.
Gson currently uses LinkedHashMap for an instance if a Map subclass does not define a default constructor.
2012-03-11 21:37:13 +00:00
Jesse Wilson a0afec71ff Test case to demonstrate no such crash as reported in issue 408. 2012-02-11 18:19:54 +00:00
Inderjeet Singh f3c14b4614 Added support for promoteNameToValue for JsonElementReader. 2011-12-03 02:35:46 +00:00
Jesse Wilson c226bd4f3f Tests to illustrate differences between GSON 1.7 and 2.0 2011-10-23 22:44:13 +00:00
Inderjeet Singh 905b7ebccc Using single quote in JSON that would be deserialized. This makes the JSON easier to read. 2011-10-20 21:35:39 +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
Jesse Wilson 194c18d20c Be backwards-compatible for serialization of maps whose keys aren't primitives. 2011-10-20 04:24:27 +00:00
Inderjeet Singh cebda2b119 Fixed MapTest.testInterfaceTypeMapWithSerializer. This test for relying on JsonElement.toString() to have same behavior as gson.toJson(JsonElement). However, gson.toJson() skips nulls by default whereas JsonElement.toString() does not. 2011-09-27 15:38:02 +00:00
Inderjeet Singh b85daafb08 suppressed unchecked warning 2011-05-11 21:43:47 +00:00
Joel Leitch f291c4d33e Fix a bunch of preserve-type issues:
- Issue 205
- Issue 294
- Issue 318
2011-04-20 22:27:51 +00:00
Joel Leitch cf3615e38c Adding tests to verify 294. 2011-04-19 22:18:25 +00:00
Joel Leitch d2cf574e86 Adding unit-tests to verify bugs. 2011-04-15 06:33:09 +00:00
Joel Leitch 97d00f4930 Add test to verify issue 309. 2011-04-13 16:14:54 +00:00
Joel Leitch f36c1bc222 Very minor cleanup. 2011-04-04 23:17:43 +00:00
Joel Leitch 2fb8c92812 Use more specific type for map serialization if possible. 2011-04-04 23:13:31 +00:00
Inderjeet Singh 1a9a54dcc2 incorporated review comments from r768 2011-04-04 21:27:37 +00:00
Joel Leitch 5af0b16641 Updating Map tests. 2011-04-04 19:07:20 +00:00
Joel Leitch 861e047a62 Create an "internals" package for classes that we do not want to share, but is needed across multiple pacakges.
As well, move non-Gson specific classes, such as Preconditions, to this new "internals" package.
2011-03-21 22:30:35 +00:00
Joel Leitch e57ef0908b Add method to GsonBuilder to enable complex key serialization of maps. 2011-03-15 15:37:41 +00:00
Inderjeet Singh 52288d7127 rawtypes -> unchecked
Fixed spurious eclipse warnings on deprecation, missing classes or parameters, etc.
2011-02-24 22:47:55 +00:00
Jesse Wilson dea7ab89fe Restore pretty printing. The pretty printing format isn't as compact as the previous format - for example arrays of integers are printed one-per-line, whereas the previous format compacted these to all sit on the same line. 2010-11-01 23:03:41 +00:00
Jesse Wilson 4e28bf3a39 Check in a passing test for issue 204. 2010-09-03 06:44:41 +00:00
Jesse Wilson 7e1e4eab07 Remove the constraint that map keys mustn't be the empty string.
See bug 227.
2010-08-28 05:02:33 +00:00
Inderjeet Singh de0f8da151 replaced unchecked suppressed warnings token with more specific rawtypes.
removed unused imports.
2010-08-20 16:27:46 +00:00
Jesse Wilson 8b5cc3256d Test demonstrating a bug reported in issue 178, wherein malformed JSON is emitted when a map key contains a double-quote. 2010-08-20 05:43:17 +00:00
Inderjeet Singh 8aedbc84db Added a new GsonBuilder option to register a type adapter for a type hierarchy instead of a single type.
Upgraded Gson version to 1.5 since a new API call is being added.
2010-06-21 23:26:06 +00:00
Joel Leitch 8297437610 Reverting r499. 2009-09-23 19:25:50 +00:00
Joel Leitch c6f762f36b Fix Warnings 2009-09-23 19:09:01 +00:00
Inderjeet Singh 3b0f8f4340 Removed all the JDK warnings about unused fields in test classes or unused constructors for use by Gson or instanceof calls on parameterized types. 2009-09-23 17:45:16 +00:00
Joel Leitch 18b301dfeb - Serializing of Object arrays.
- Fixed incorrect warning
2009-09-22 19:04:27 +00:00
Inderjeet Singh 82771f006c removed Java 1.5 warnings 2009-08-31 17:51:47 +00:00
Inderjeet Singh 1c5785be57 Tests to reproduce issue 95. The tests currently pass so the bug will be marked as invalid. 2009-03-12 20:54:00 +00:00
Inderjeet Singh da8a1feee8 Added tests for the bugreport http://code.google.com/p/google-gson/issues/detail?id=99 2009-03-03 21:09:07 +00:00
Joel Leitch 02decace26 Added the ability to deserialize a Map "key" object from a String into a complex Java type. 2009-01-06 07:09:19 +00:00
Joel Leitch fc65667d2f Add support for wildcard type on Maps, Collections and other parameterized types. 2008-12-14 07:12:04 +00:00
Joel Leitch b90228dcc0 Enable serialization of nulls within Maps. 2008-11-30 23:01:14 +00:00
Joel Leitch b6f767bf05 Fix warning in code 2008-11-15 05:13:05 +00:00
Inderjeet Singh 9a69560d9f During serialization, we now dont call custom serializers the field is null.
During deserialization, we do not call custom deserializer if the field is to be set to null. Moreover, changed the logic to set fields to null only if explicitly indicated in the incoming Json. This is different from past behavior where all fields not mentioned in incoming Json were set to null. Now they are set to whatever the default constructor will do.
2008-11-14 20:52:57 +00:00
Inderjeet Singh bc2c25f235 Removed ExceptionWrapper from serializers.
This is done since it is improper to throw a parse exception from serializers. Moreover, the serializers dont deal with external input, they deal with classes, so they need not guard against spurious input.
2008-11-14 02:17:19 +00:00
Inderjeet Singh 9245bebdba For the Collection and Map types, using ObjectConstructor to create instance instead of hard-coding a specific type.
This helps is handling cases where the user is using their own subclass of Collection or Map.

Updated ParameterizedTypeHandlerMap to return the handler corresponding to Map and Collection for subclasses if user has not specified a specific handler.

Fixed the logic in JsonTreeNavigator to not output a comma if the first field of an object was null.
2008-11-14 02:11:46 +00:00