Commit Graph

356 Commits

Author SHA1 Message Date
Jesse Wilson
6b6c1af907 [maven-release-plugin] prepare for next development iteration 2018-11-09 10:04:52 +11:00
Jesse Wilson
eb7110bf59 [maven-release-plugin] prepare release moshi-parent-1.8.0 2018-11-09 10:04:36 +11:00
Eric Cochran
878b3ff93b Add CheckReturnValue annotation to peekJson. (#736)
* Add CheckReturnValue annotation to peekJson.

* Suppress test warning.
2018-11-09 07:41:45 +11:00
Eric Cochran
81db25825d Add CheckReturnValue annotation to beginFlatten. 2018-11-06 10:15:01 -08:00
Eric Cochran
5c41565f39 Fall back to reflection when generated adapter is not found. (#728)
* Fall back to reflection when generated adapter is not found.

This is handy for development builds where kapt is disabled and models still have @JsonClass(generatedAdapter = true).

* Add test for Kotlin reflection fallback behavior.
2018-11-06 18:28:36 +11:00
Jesse Wilson
1acc70dd70 Merge pull request #710 from technoir42/keep-nested-class-adapters
Retain generated JsonAdapters for nested classes
2018-11-04 08:23:23 +10:00
technoir
9e3d2345f9 Retain generated JsonAdapters for nested classes 2018-11-04 00:52:05 +03:00
Jesse Wilson
978d4dddd5 Fix prose in deferred adapters 2018-11-03 22:36:17 +11:00
Eric Cochran
fe7ba863b4 Use BufferedSource.getBuffer(). 2018-11-02 17:03:45 -07:00
Jesse Wilson
ce65ff5527 Fix a race condition on deferred adapters
This changes how we lookup and cache adapters. Previously we were pretty
optimistic about putting adapters in the cache; these adapters could have
depended upon stubs that were incomplete.

Now we're a lot more careful: we only put adapters in the cache if the
root object that triggered a set of recursive calls was constructed
successfully.

Closes: https://github.com/square/moshi/issues/679
2018-10-22 21:06:31 -04:00
Jesse Wilson
f28bca609a JSON flattening.
This is a new API that makes it possible to do more interesting things
with composition. It's currently write-only; doing composition on reads
is much more difficult.
2018-10-19 10:59:19 -04:00
Eric Cochran
931673c264 Fix Javadoc code formatting for JsonReader.peek(). 2018-10-08 12:48:44 -07:00
Jesse Wilson
7055391230 Implement peekJson() for JsonUtf8Reader
This required an upgrade to Okio 1.16.0.
2018-10-08 11:44:03 -04:00
Jesse Wilson
eb64d186a6 Merge pull request #680 from square/jwilson.0923.peekvalue
Implement peekJson() for JsonValueReader
2018-10-07 16:59:20 -04:00
sergey
b5db9fa7f1 Always keep fields of annotated enums 2018-09-27 00:54:39 +03:00
Gabriel Ittner
b7055944a9 Proguard config: keep field names of annotated enums (#691)
closes #689
2018-09-25 11:52:05 -07:00
Jesse Wilson
00dcac60d4 Implement peekJson() for JsonValueReader
The JsonUtf8Reader variant relies on an update to Okio that we're
not quite ready for.

This one became straightforward after I changed out the iterators
to be cloneable. That's necessary to split one iterator into two.
It's too bad the platform's built-in iterators are not cloneable;
that would have been convenient and potentially more efficient.

Related to https://github.com/square/moshi/issues/672
2018-09-24 23:21:07 -04:00
Jesse Wilson
2cb81857ac [maven-release-plugin] prepare for next development iteration 2018-09-24 22:55:49 -04:00
Jesse Wilson
9a652f8788 [maven-release-plugin] prepare release moshi-parent-1.7.0 2018-09-24 22:55:35 -04:00
Jesse Wilson
026d16ba68 Don't include the 'internal' package in Javadocs 2018-09-24 22:35:29 -04:00
Jesse Wilson
735f0c39f7 Upgrade Kotlin, AssertJ, compile-testing, and kotlin-metadata dependencies 2018-09-24 21:48:25 -04:00
Eric Cochran
5a46cd6bd5 Use BufferedSource.indexOf instead of loops. (#677)
Cleanup of a rare code path for block comments in lenient readers.
2018-09-20 21:20:11 -07:00
Benoit Quenaudon
df730cafb9 Fix JsonQualifiers test 2018-09-13 15:02:06 -04:00
Eric Cochran
895c3ddb49 Track field names in the adapter lookup stack. (#616)
* Track field names in the adapter lookup stack.

This allows for an error message that includes field names to track down the cause of adapter creation failure for deeply nested structures.

* Use a single stack in Moshi client.

* Make optional fieldName parameter public API.

* Simplify error message.
2018-09-12 22:27:58 -04:00
Jesse Wilson
83b6b26e63 Merge pull request #659 from square/eric.exception-cause
Add exception cause for method adapter creation.
2018-09-12 22:24:22 -04:00
Benoit Quenaudon
c606f43a3d Don't reflect on androidX 2018-09-12 15:11:42 -04:00
Eric Cochran
46a42bc7ed Add exception cause for method adapter creation. 2018-09-11 22:25:09 -07:00
Jesse Wilson
76cd590ca3 Generate nicer stacktraces when creating a generated adapter fails.
Otherwise we end up with many InvocationTargetExceptions layered in, which makes
it difficult to identify what actually failed.
2018-09-11 22:02:54 -04:00
Eric Cochran
e7c745aac8 Make generated adapters null-safe.
This is in alignment with the lookup for Java and Kotlin reflective adapters.
2018-09-10 16:31:24 -07:00
Jesse Wilson
2a593da06c Merge pull request #628 from gabrielittner/master
Embed ProGuard rules in the jar
2018-09-08 14:58:44 -04:00
Gabriel Ittner
24e0777ebd add period to comments 2018-09-07 08:04:56 +02:00
Jorge Antonio Díaz-Benito Soriano
56e67088a9 Remove unnecessary isAccessible check
https://github.com/square/moshi/issues/624
2018-08-19 20:46:43 +02:00
Gabriel Ittner
4bbc5b2ff8 Embed ProGuard rules in the jar 2018-08-19 11:14:47 +02:00
Eric Cochran
137ffc992f Fix incorrect path in enum adapter error message. (#613) 2018-08-06 22:46:41 -07:00
Eric Cochran
627e62f507 Fix hasNext to return false at document end. 2018-06-22 15:18:22 -07:00
Eric Cochran
df3a6ce2ae Remove redundant "to" in doc. 2018-05-23 12:28:07 -07:00
Eric Cochran
d31f3c2482 Add more CheckReturnValues for JsonReader.
This encourages skipName over nextName.
2018-05-15 18:37:29 -07:00
Jesse Wilson
31ef245eeb [maven-release-plugin] prepare for next development iteration 2018-05-14 23:00:15 -04:00
Jesse Wilson
bf4d1f8693 [maven-release-plugin] prepare release moshi-parent-1.6.0 2018-05-14 23:00:02 -04:00
Jesse Wilson
986cc4c794 [maven-release-plugin] prepare for next development iteration 2018-05-06 21:50:45 -04:00
Jesse Wilson
c2f890879c [maven-release-plugin] prepare release moshi-parent-1.6.0-RC1 2018-05-06 21:50:39 -04:00
Jesse Wilson
7b1177adbc Merge pull request #503 from square/eric.write-from-source
Allow writing out raw JSON.
2018-05-06 21:11:34 -04:00
Zac Sweers
4b610329bd Full JsonQualifier support in kotlin codegen. 2018-05-06 21:09:28 -04:00
Eric Cochran
b848f1cc52 Add JsonReader.skipName. 2018-04-30 18:41:18 -07:00
Eric Cochran
a0cd8a4fc0 Allow writing out raw JSON. 2018-04-29 23:49:47 -07:00
Jesse Wilson
b96397f6eb Merge pull request #500 from square/eric.coherent-nesting-problem-error-message
Add coherent error message for uneconded map keys.
2018-04-28 21:14:45 -04:00
Eric Cochran
44e6fbd067 Add coherent error message for unencoded map keys. 2018-04-25 11:36:47 -07:00
Eric Cochran
b125f06e70 Fix up out-of-date comments. 2018-04-24 13:17:40 -07:00
Eric Cochran
84745b0537 Disallow null Type from entering user code.
Otherwise, Moshi.adapter(null) will end up calling into user JsonAdapter factories with a null Type parameter.
Kotlin fails with java.lang.IllegalArgumentException: Parameter specified as non-null is null
That message ends up too far away from the real error.
2018-04-15 21:04:17 -07:00
Eric Cochran
b860b6da4f Make error message for dangling names consistent. (#501) 2018-04-15 19:48:32 -07:00