Commit Graph

727 Commits

Author SHA1 Message Date
Marcono1234
b5343ba96c
Add tests for enum constant toString() reading (#2080) 2022-02-21 14:53:59 -08: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
47dea2eefc
Improve error message when abstract class cannot be constructed (#1814) 2022-02-04 14:19:47 -08:00
Marcono1234
565b7a198e
Support EnumMap deserialization (#2071) 2022-02-04 07:20:32 -08:00
Marcono1234
e2e851c9bc
Add LazilyParsedNumber default adapter (#2060)
* Add LazilyParsedNumber default adapter

* Validate JsonWriter.value(Number) argument

* Fix incorrect JSON number pattern, extend tests
2022-01-28 11:26:28 -08:00
Marcono1234
710a76c8b8
Fix JsonReader.hasNext() returning true at end of document (#2061) 2022-01-27 15:59:50 -08:00
Éamonn McManus
26e08fe742
Fix a mistaken use of StringBuilder('#'). (#2052) 2022-01-12 08:58:30 -08:00
Marcono1234
d38e397421
Fix ObjectTest not restoring default Locale (#2050) 2022-01-10 07:18:42 -08:00
Marcono1234
6b96a389cc
Put module-info.class into Multi-Release JAR folder (#2013)
* Put module-info.class into Multi-Release JAR folder

Uses ModiTect to place module-info.class under Multi-Release JAR folder
`META-INF/versions/9`.

* Adjust pom.xml to drop support for Java 6

* Change doclint setting

All Javadoc errors have been solved previously; doclint can now be enabled
without causing build failures.

* Improve README Java requirements
2022-01-01 12:44:39 -08:00
Marcono1234
dc28951fa7
Change target Java version to 7 (#2043)
* Change target Java version to 7

* Document Gson requirements

* Add package-info.java for `stream` package
2021-12-31 07:20:29 -08:00
Marcono1234
615c8835d3
Add GsonBuilder.disableJdkUnsafe() (#1904)
* Add GsonBuilder.disableJdkUnsafe()

* Address review feedback
2021-12-30 15:08:18 -08:00
yixingz3
eaf9a0342d
feat: added UPPER_CASE_WITH_UNDERSCORES in FieldNamingPolicy (#2024) 2021-11-28 09:33:22 -08:00
Éamonn McManus
6e06bf0d89 Fix for an ArrayIndexOutOfBoundsException.
The `fillBuffer` method changes `pos`, so it is incorrect to cache
its previous value.
2021-11-11 14:12:44 -05:00
Marcono1234
b0595c595b
Fix failing to serialize Collection or Map with inaccessible constructor (#1902)
* Remove UnsafeReflectionAccessor

Revert #1218

Usage of sun.misc.Unsafe to change internal AccessibleObject.override field
to suppress JPMS warnings goes against the intentions of the JPMS and does not
work anymore in newer versions, see #1540.
Therefore remove it and instead create a descriptive exception when making a
member accessible fails. If necessary users can also still use `java` command
line flags to open external modules.

* Fix failing to serialize Collection or Map with inaccessible constructor

Also remove tests which rely on Java implementation details.

* Don't keep reference to access exception of ConstructorConstructor

This also avoids a confusing stack trace, since the previously caught
exception might have had a complete unrelated stack trace.

* Remove Maven toolchain requirement

* Address review feedback

* Add back test for Security Manager
2021-11-09 07:16:35 -08:00
Marcono1234
ca2ed748ba
Fix warnings (#2014)
* Fix warnings

* Address review feedback
2021-11-07 08:43:49 -08:00
Marcono1234
deaa3a6cd9
Fix Gson.newJsonWriter ignoring lenient and HTML-safe setting (#1989)
* Improve Gson newJsonWriter and newJsonReader documentation

* Consider lenient and HTML-safe setting for Gson.newJsonWriter

* Remove empty line between imports
2021-11-01 15:11:10 -07:00
Marcono1234
e0de45ff69
Delete unused LinkedHashTreeMap (#1992)
Class seems to be unused since commit f29d5bc37b.
Gson currently only uses LinkedTreeMap.
2021-11-01 15:09:14 -07:00
Marcono1234
b4dab86b10
Make default adapters stricter; improve exception messages (#2000)
* Make default adapters stricter; improve exception messages

* Reduce scope of synchronized blocks

* Improve JsonReader.getPath / getPreviousPath Javadoc
2021-11-01 15:08:04 -07:00
Marcono1234
b3188c1132
Fix FieldNamingPolicy.upperCaseFirstLetter uppercasing non-letter (#2004) 2021-11-01 15:05:04 -07:00
Jaroslav Tulach
ca1df7f7e0
#1981: Optional OSGi bundle's dependency on sun.misc package (#1993)
* #1981: Avoid OSGi bundle's dependency on sun.misc package

* Specify optional dependency on sun.misc.Unsafe

* Adjusting the test to sun.misc import being optional

* Using Collections.list and for loop

* Let the fail message include name of package

Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>

* Closing the input stream

* Dedicated assertSubstring method

Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
2021-10-25 11:32:10 -07:00
Marcono1234
c54caf308c
Deprecate Gson.excluder() exposing internal Excluder class (#1986) 2021-10-25 11:28:16 -07:00
Marcono1234
e6fae590cf
Prevent Java deserialization of internal classes (#1991)
Adversaries might be able to forge data which can be abused for DoS attacks.
These classes are already writing a replacement JDK object during serialization
for a long time, so this change should not cause any issues.
2021-10-13 10:14:57 -07:00
Marcono1234
bda2e3d16a
Improve number strategy implementation (#1987)
* Fix GsonBuilder not copying number strategies from Gson

* Improve ToNumberPolicy exception messages
2021-10-11 16:14:47 -07:00
Marcono1234
cd748df712
Fix LongSerializationPolicy null handling being inconsistent with Gson (#1990)
Gson does not actually use the specified LongSerializationPolicy but instead
uses type adapters which emulate the behavior. However, previously Gson's
implementation did not match LongSerializationPolicy regarding null handling.

Because it is rather unlikely that LongSerializationPolicy has been used on
its own, this commit adjusts its implementation to match Gson's behavior
(instead of the other way around).
2021-10-11 12:34:32 -07:00
Lyubomyr Shaydariv
fe30b85224
Support arbitrary Number implementation for Object and Number deserialization (#1290)
* Object and Number type adapters number deserialization can be configured

* Change wording of ToNumberStrategy documentation

* Use inline links in doc sparingly

If the element has already been linked before, don't create a link for
every subsequent occurrence.

See also (slightly dated)
https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html#inlinelinks

* Link to default to-number policies in ToNumberStrategy doc

* Reduce code duplication for deserializing Number

* Hide default factory constants of NumberTypeAdapter and ObjectTypeAdapter

This encapsulates the logic a little bit better.
Additionally refactored factory created by NumberTypeAdapter to only create
TypeAdapter once and then have factory reuse that adapter for better
performance.

Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
2021-10-08 17:09:43 -07:00
Éamonn McManus
c8f26dc907
Add missing calls when testing for exceptions. (#1948) 2021-08-31 15:03:45 -07:00
Éamonn McManus
1a2e58a42f
Remove an unused import. (#1947) 2021-08-31 14:55:07 -07:00
Simon Guerout
ac14b4c197 Make the nextJsonElement more robust
Add test cases
2021-08-30 09:57:08 -07:00
Éamonn McManus
69173b02ea
Merge branch 'master' into optional-sql 2021-08-24 13:41:12 -07:00
Éamonn McManus
9edaeb3b2e
Merge pull request #1909 from HiFromAjay/aj
Test cases for testing the exceptional behavior of JsonArray get... methods
2021-08-07 07:54:12 -07:00
HiFromAjay
01ab13f701 Remove unused imports [#1909, #1908] 2021-08-05 17:23:28 -06:00
YOUNG HO CHA
d8c5fcf00b Fix indentation of EnumWithObfuscatedTest 2021-08-04 12:30:07 +09:00
YOUNG HO CHA
92a98dab02 Removed unused import 2021-08-04 12:03:15 +09:00
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
HiFromAjay
2d1981d39b modify test cases for testing the exceptional behavior of get... methods [use fail(...), use JsonArray methods, remove unused values, formatting, #1909, #1908] 2021-06-14 14:31:14 -06:00
HiFromAjay
55115a5ca2 Test cases for testing the exceptional behavior of get, getAsBoolean, getAsDouble, getAsInt, getAsJsonArray, getAsJsonObject, getAsLong, and getAsString methods of JsonArray class. These test cases, which we wrote according to the specified behavior of each method, that helped us in identifying the documentation bugs in JsonArray and JsonElement classes, which we submitted issues for (Issue #1908). Note that we have adapted these test cases based on similar tests from the JSON-java project (https://github.com/stleary/JSON-java). 2021-06-11 10:04:32 -06:00
Richard Hernandez
b39494dbe6 Fix fallback behavior of UnsafeReflectionAllocator when AccessibleObject isn't so accessible 2020-05-26 20:12:36 -07:00
Marcono1234
4fb215c9df Move SQL types specific tests to separate test class 2020-05-23 23:31:03 +02:00
Marcono1234
380c4ec12c Make dependency on java.sql optional 2020-05-23 23:30:53 +02:00
Marcono1234
361292f1c1 Fix warnings 2020-05-09 17:34:53 +02:00
Marcono1234
541252a9fb Implement DefaultDateTypeAdapter in a type safer way 2020-05-09 17:34:52 +02: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
Inderjeet Singh
1fa43821e8 removed unneeded null check. 2016-02-25 19:37:07 -08:00
Inderjeet Singh
79a00cd906 incorporated code review feedback. Simplified the code, merged Device and Control and removed unnecessary fields. 2016-02-25 17:38:48 -08: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
Danillo Souza
ed6298c98a timezones without minutes should are valid according RFC3339 2016-01-11 15:33:55 -02:00
Gorik
bcd52a1fdc Added ISO8601 complete support for date deserialization 2015-11-23 01:11:41 -05:00
Inderjeet Singh
10cefa49d2 added tests for Properties 2015-11-06 16:17:47 -08:00
Inderjeet Singh
01944b246b additional tests for PriorityQueue, Vector and Stack. 2015-11-06 16:16:56 -08:00
Inderjeet Singh
47cc34548d added currency class 2015-11-06 15:41:15 -08:00
Inderjeet Singh
457f53f08f renamed JavaUtilConcurrentLocksTest to JavaUtilConcurrentAtomicTest 2015-11-06 15:24:15 -08:00
Inderjeet Singh
da4334b8df fixed typos 2015-11-05 21:43:10 -08:00
Inderjeet Singh
11b26b5256 Added support for AtomicLongArray.
Also added tests to ensure LongSerializationPolicy is honored.
2015-11-05 14:15:46 -08:00
Inderjeet Singh
7821b73202 Added support for AtomicInteger, AtomicBoolean, AtomicLong and AtomicIntegerArray. 2015-11-05 10:45:23 -08:00
Inderjeet Singh
fef43b2aaa Added support to serialize/deserialize ConcurrentMap and ConcurrentNavigableMap. 2015-11-04 21:25:15 -08:00
Inderjeet Singh
e5b3f6368d updated minimum JDK version to 1.6.
Added Overrides for methods implementing an interface.
2015-11-04 18:52:20 -08:00
inder123
fe101c10bc Merge pull request #719 from google/jwilson_1021_runtime_type_mismatch
Fix type hierarchy adapters to do a runtime check.
2015-10-22 09:29:01 -07:00
jwilson
7d1973e6c5 Fix type hierarchy adapters to do a runtime check.
Otherwise if we have a type hierarchy adapter for Vehicle, and we
attempt to decode a JSON string as a Car, we get the right exception
if the JSON string is actually decoded as a Truck.
2015-10-21 11:42:30 -04:00
Inderjeet Singh
109915d93a Implemented support for multiple values for SerializedName annotation. 2015-10-03 02:01:30 -07:00
Inderjeet Singh
3aec173243 small reformatting 2015-09-26 18:02:12 -07:00
Inderjeet Singh
3daf585931 Implemented equals and hashcode for LazilyParsedNumber to fix
https://github.com/google/gson/issues/627
2015-09-26 17:58:13 -07:00
Inderjeet Singh
fbb8696e83 Added tests for deserialization of double array 2015-09-01 17:49:34 -07:00
Vladislav Bauer
eb79ec73f0 Add unit tests for constructors from util classes 2015-08-15 05:29:46 +06:00
inder123
0a93efada5 Merge pull request #652 from schlan/fix_turkish_locale_issues
Fix issues if runing in an environment with a Turkish locale
2015-08-08 09:10:48 -07:00
inder123
24eec9428b Merge pull request #671 from ownaginatious/master
Support for adding primitives directly to JsonArray instances
2015-07-26 14:17:10 -07:00
Dillon Dixon
5cf82a573f Added test for nulls 2015-07-23 23:02:46 -07:00
Dillon Dixon
a67ca052a3 Added test for mixed primitives 2015-07-23 23:00:18 -07:00
Dillon Dixon
374e5b0aa5 Added test ovr new DOM functionality 2015-07-23 22:57:32 -07:00
Adam Tanner
457541611c Replace localhost lookup with static IP to fix test.
Calling InetAddress.getLocalHost() will cause a lookup to occur that may
fail with a java.net.UnknownHostException if the system the test is
running on is not configured correctly.

This is often fixed by echoing "127.0.0.1 $HOSTNAME" to /etc/hosts, but
in this case it seems easier to pick a static IP string to avoid the
lookup entirely and prevent false negatives in the test.
2015-07-20 14:03:52 -07:00
Adam Tanner
f7abd59a3b JsonWriter#jsonValue writes raw JSON values.
Add a jsonValue(String value) method that takes a raw JSON string that
can be used to write the string directly to the underlying writer
without modification.

The intended use case for this is when building JSON that contains a
pre-serialized JSON string as a value in an object or array.
2015-07-20 10:56:56 -07:00
Sebastian Chlan
299ee89852 Add tests to demonstrate the issue
Run the FieldNamingTest with the JVM options: `-Duser.language=tr
-Duser.region=TR`
2015-06-09 15:12:38 +01:00
Inderjeet Singh
fdaa6b05c4 ensuring that the type field is written by runtime type adapter 2014-12-10 22:57:08 +00:00
Inderjeet Singh
7d96ce8d6d fixed tests to take care of stackTrace element appearing sometimes 2014-12-10 22:43:44 +00:00
Inderjeet Singh
8d5a41329e added tests for Throwable. Revised ReflectiveTypeAdapterFactory to ignore self-referencing fields. 2014-11-16 22:55:18 +00:00
Inderjeet Singh
1de2ace065 removed eclipse warnings. updated maven plugins to the latest versions 2014-11-16 20:45:01 +00:00
Inderjeet Singh
60b2370c74 added a test for RuntimeTypeAdapterFactory using JsonAdapter annotation 2014-11-11 22:04:20 +00:00
Inderjeet Singh
e652ec0dd9 revised a test to validate that we can query a delegate adapter from typeadapterfactorie registered in JsonAdapter 2014-11-11 02:02:56 +00:00
Jesse Wilson
d6c8c1e3cf Fix bugs in getPath() with arrays of objects and arrays of arrays 2014-11-11 01:59:48 +00:00
Jake Wharton
7f8f490fdc Re-order factories to allow @JsonAdapter on enums which are user-defined types. 2014-11-04 00:59:42 +00:00
Jesse Wilson
ea17ccc651 Restore missing fails. 2014-08-12 21:06:56 +00:00
Jake Wharton
117d8ea68f Add TypeAdapterFactory support to @JsonAdapter. 2014-08-04 16:58:41 +00:00
Jesse Wilson
125e6d9d3d Change field annotations to take precedence over registered type adapters. 2014-08-02 18:22:43 +00:00
Inderjeet Singh
f9a302e22a incorporated code review feedback. Added a test to ensure JsonAdapter validation doesn't carry side-effects to other fields 2014-08-01 02:16:42 +00:00
Jesse Wilson
fbc7e69c81 Implement JsonPath in JsonReader. 2014-07-31 05:17:54 +00:00
Inderjeet Singh
b9578a4d7e renamed JsonArray.has() to JsonArray.contains() 2014-07-04 02:03:34 +00:00
Inderjeet Singh
94e21eca21 renamed JsonArray.contains() to has() to be consistent with JsonObject.has() 2014-07-03 17:31:07 +00:00
Inderjeet Singh
06282a4d13 Fixed issue code.google.com/p/google-gson/issues/detail?id=353 by adding set method in JsonArray 2014-07-02 18:30:17 +00:00
Inderjeet Singh
9bbdcac5a8 Fixed issue code.google.com/p/google-gson/issues/detail?id=353 by adding remove and contains methods in JsonArray 2014-07-02 18:21:36 +00:00
Inderjeet Singh
14ba59fa88 code review fixes. Moved getFirstArgument() method from $Gson$Types to GsonTypesTest. 2014-05-19 17:34:25 +00:00
Inderjeet Singh
edf66083e6 renamed @Adapt to @JsonAdapter 2014-03-26 17:59:54 +00:00
Inderjeet Singh
7f6a096030 renamed JsonAdapter annotation to Adapt annotation. 2014-03-09 23:08:54 +00:00
Inderjeet Singh
67af0dd8f8 Added javadoc comment in JsonAdapter explaining the usage for fields.
Added a (broken) test the ensure a field annotation for JsonAdapter supersedes a class annotation.
2014-03-09 08:21:06 +00:00
Inderjeet Singh
f88eee094c removed some eclipse warnings 2014-03-09 07:33:08 +00:00
Inderjeet Singh
eaaa2a1b4f added functional tests for applying JsonAdapter annotation on Fields. 2014-03-09 07:31:02 +00:00
Inderjeet Singh
b9998e511f deleted support for the magic GSON_TYPE_ADAPTER field 2014-03-09 07:30:37 +00:00
Inderjeet Singh
bf549f0589 Added support for JsonAdapter annotation on fields 2014-03-09 07:28:04 +00:00
Inderjeet Singh
67d512ee7d Created a JsonAdapter annotation that can be applied to classes to indicate their TypeAdapter. 2014-03-08 22:37:19 +00:00