Commit Graph

42 Commits

Author SHA1 Message Date
Johannes Frohnmeyer dc4e61ac7b
Several breaking changes 2022-05-17 21:20:10 +02:00
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
Marcono1234 d38e397421
Fix ObjectTest not restoring default Locale (#2050) 2022-01-10 07:18:42 -08: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
Andrey Mogilev 0aaf5ff408 fix Java9 DateFormat changes (#1211)
* fix Java9 DateFormat changes

* fix Codacy warnings
2017-12-30 00:44:43 +05:30
Inderjeet Singh a3f11150cc removed more eclipse warnings 2013-04-12 20:12:12 +00:00
Joel Leitch b0531e1649 Ensure "excluder" is added prior to user defined type adapters/factories.
- Added test expose bad behaviour.
2012-12-20 19:41:33 +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 3a3870591e Tests to demonstrate that GSON 2 fixes some user-reported bugs. 2011-10-02 15:18:12 +00:00
Jesse Wilson 38ce53766e More consistency on serializeNulls: we never emit the empty string for top-level objects. 2011-10-01 01:10:11 +00:00
Jesse Wilson bb7f0b6bb0 Adopt JsonElementWriter in GSON.
Add setSerializeNulls() to JsonWriter, so nulls can be skipped from serialization. This does not yet impact JsonElementWriter.

One change in behavior: if the only value is skipped, we now emit "null" rather than "".
2011-09-30 07:08:44 +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 103edb9c36 Don't return null on an unexpected EOF unless the document is empty. This brings us back to compatibility with GSON 1.5. 2010-11-08 19:16:05 +00:00
Inderjeet Singh d3eda04f33 Added support for deserializing from null input to a null value.
Added toString() method to ObjectTypePair.
2010-10-22 16:06:59 +00:00
Jesse Wilson eb7b1e4ac7 Test attempting (and failing) to reproduce issue 215. 2010-08-27 07:10:00 +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
Inderjeet Singh 1da3ef9891 Ensured that a custom handler is not visited during deserialization.
Ensured that JsonTreeNavigator can handle null values as children of JsonObject. This is now possible since Gson exposes toJson(JsonElement) method to which the user can pass a JsonElement with null values.
2009-10-06 01:15:28 +00:00
Inderjeet Singh 907082102d Added code to ensure that circular reference situations with custom handlers are detected.
Split CircularReferenceTest out of ObjectTest.
2009-09-29 20:43:31 +00:00
Inderjeet Singh 3e7ebf8556 Fixed issue 156.
Added support for serializing an object field (or array elements) as per its actual type.
Refactored inheritance related tests into its own test class. Added regression tests for issue 156.
2009-09-25 19:54:25 +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 cbcf7defa3 Updated Grammar for matching JsonArray to be left-associative rather than right-associative. Gson can now parse arrays of size over 11MB instead of 80KB which was the prior limit. Thanks for the tip, kenotron. 2009-08-22 01:03:27 +00:00
Inderjeet Singh 03a3cc83c3 Attempt to reproduce issue 140 2009-08-07 01:12:41 +00:00
Inderjeet Singh 64172d1dac Added support to serialize and deserialize array of java.lang.Object when the content is a primitive type. 2009-07-27 23:24:23 +00:00
Joel Leitch abf4ab2d78 Fix project so it still compiles with JDK 1.5. 2009-05-19 17:51:02 +00:00
Inderjeet Singh 6e59e502c2 Refactored the Async parser interface out of JsonParser into a new class JsonParserAsync. Updated the JsonParser to detect Eof and return a null instead of throwing a ParseException. 2009-05-14 20:18:45 +00:00
Inderjeet Singh e340801d25 Moved enum-related tests under EnumTest class. 2009-03-30 18:36:55 +00:00
Inderjeet Singh 4fc6400f5c Fixed the test that broke while fixing issue 100 in r394 by using a TreeSet for SortedSets and HashSet for other kind of sets. 2009-03-12 18:17:14 +00:00
Joel Leitch 8e1c6a2b37 Ensure that BigDecimals fields are properly converted into its string representation. 2008-12-14 05:56:41 +00:00
Joel Leitch ea79cd6812 Allow booleans and number to be deserialized into a "String" field/object. 2008-12-14 04:42:16 +00:00
Inderjeet Singh 7334a33d14 Test to verify support for object member names without quotes (see Issue 41). 2008-11-26 17:49:35 +00:00
Joel Leitch 0d8150fe52 Major restructuring of Primitve type serialization and deserializtion. From the end-user's point of view there should be no difference other than the user can now override the default serialization/deserialization their own custom type adapter (not sure if there is a real use-case out there for this).
This restructuring greatly cleans up the code and reduces some complexity; however, there is more that can be done to clean this up (i.e. get rid of "InstanceCreators" for primitive Type Adapters).
2008-11-15 02:26:57 +00:00
Inderjeet Singh 5631132892 Fixed Issue 54 to enable serialization of fields that are declared of type
Object.
2008-10-13 21:12:41 +00:00
Inderjeet Singh f6a278018e test for Issue 51 for inner classes serialization and deserialization. 2008-10-13 19:49:05 +00:00
Inderjeet Singh 1abf693b70 Fix for Issue 55 where GSON was unable to deserialize JSON with single quotes
(') used for field name/values. Gson now supports different fields with-in the
JSON to use either single quote or double quote. However, a single field name
or value must use ' or "" to delimit itself.
2008-10-10 02:53:54 +00:00
Inderjeet Singh 427c17a732 added a test for checking if GSON can parse JSON that uses single quotes
instead of double quotes for various field values.
2008-10-10 02:32:50 +00:00
Inderjeet Singh 3b8404dac5 refactored String related functional tests out in a separate test class. 2008-10-10 02:29:06 +00:00
Inderjeet Singh 57d1f32de5 moved gson as a project under trunk 2008-09-01 03:13:32 +00:00