Eric Cochran
a920b9be3a
Improve error message for platform types.
...
The error message about platform types will never contain qualifiers.
Also, simplify platform type check.
2018-11-19 02:31:07 -08:00
Jesse Wilson
8b17ecedae
Merge pull request #745 from square/eric.incorrect-skipValue
...
Fix infinite loop when calling skipValue at the end an object or array.
2018-11-18 10:18:02 -05:00
Eric Cochran
5f0b2ee8e3
Allow Object base type for PolymorphicJsonAdapterFactory. ( #744 )
...
* Allow Object base type for PolymorphicJsonAdapterFactory
This works now.
Using general types like Object, Map, or List for the base type is error-prone, but the checks for these cases are not worth the code cost.
* Delete redundant test.
Let's not encourage users to use Object as a base type by showing it in a test.
2018-11-18 10:15:41 -05:00
Zac Sweers
6e6abf54ab
Merge pull request #747 from square/eric.null-safe-adapters
...
Fix test for null-safe KotlinJsonAdapterFactory adapters.
2018-11-17 03:00:32 -08:00
Eric Cochran
38b08f81e6
Fix test for null-safe KotlinJsonAdapterFactory adapters.
2018-11-17 02:23:28 -08:00
Eric Cochran
5bf14098d1
Fix infinite loop when calling skipValue at the end an object or array.
...
Fail with a clear message. This is useful when iteratoring through an array, making assumptions about the size without using hasNext.
Also, disallow calling skipValue at the end of a document. This is a behavior change.
2018-11-16 10:20:38 -08:00
Jesse Wilson
5f5631e34f
Replace Okio 2.x with 2.1
2018-11-10 14:42:18 -05:00
Jesse Wilson
98459dd8ab
Reference 1.8 in the README
2018-11-09 09:41:10 +10:00
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
Jesse Wilson
69d4f40a12
Update changelog for 1.8.0
2018-11-09 10:01:07 +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
Jake Wharton
103ae3cec6
Merge pull request #737 from square/eric.CheckReturnValue-writer
...
Add CheckReturnValue annotation to beginFlatten.
2018-11-06 11:06:02 -08:00
Eric Cochran
81db25825d
Add CheckReturnValue annotation to beginFlatten.
2018-11-06 10:15:01 -08:00
Stefan M
cf22bf9bce
Add Gradle Kotlin DSL for dependencies ( #719 )
...
* Add Kotlin DSL for dependencies
* Use the "Kotlin" sytnax
2018-11-06 00:05:15 -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
a8102bccd2
Merge pull request #733 from daugeldauge/fix-variance-issues
...
Fix variance issues in kotlin-codegen
2018-11-05 07:22:40 +11:00
Artem Daugel-Dauge
8a22f6b133
Do not check required property for null second time ( #732 )
...
* Do not check required property second time
* Fix codestyle
2018-11-04 09:44:10 -08:00
Artem Daugel-Dauge
0e3a52b729
Use javaObjectType instead of Java primitives while creating parametrized type ( #731 )
...
* Add test for collection of primitives
* Use javaObjectType instead of Java primitives while creating parametrized type
2018-11-04 09:42:51 -08:00
Artem Daugel-Dauge
e0be5f5a54
Fix variance issues
2018-11-04 17:11:22 +03: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
fc4b92710e
Merge pull request #729 from square/jwilson.1103.fix_lookup_chain_prose
...
Fix prose in deferred adapters
2018-11-04 04:11:05 +10:00
Jesse Wilson
978d4dddd5
Fix prose in deferred adapters
2018-11-03 22:36:17 +11:00
Jesse Wilson
0cb2aef646
Merge pull request #726 from square/eric.kp$
...
Update to KotlinPoet 1.0.0-RC2.
2018-11-03 12:13:26 +10:00
Jesse Wilson
1e4be0e16f
Merge pull request #727 from square/eric.getBuffer
...
Use BufferedSource.getBuffer().
2018-11-03 12:12:05 +10:00
Eric Cochran
fe7ba863b4
Use BufferedSource.getBuffer().
2018-11-02 17:03:45 -07:00
Eric Cochran
0795e9cbd5
Update to KotlinPoet 1.0.0-RC2.
...
Also, use KotlinPoet's escaping for $ characters in formatted strings.
This is partly a revert of 01f600c
(https://github.com/square/moshi/pull/604/ ).
2018-11-02 16:59:27 -07:00
Jesse Wilson
9eb142d05b
Merge pull request #714 from square/jwilson.1021.fix_deferred_races
...
Fix a race condition on deferred adapters
2018-10-22 21:31:52 -04: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
daa0441ab3
Merge pull request #713 from square/jwilson.1019.runtime_polymorphic
...
Rename RuntimeJsonAdapterFactory to PolymorphicJsonAdapterFactory
2018-10-20 00:54:14 -04:00
Jesse Wilson
89103b6d13
Rename RuntimeJsonAdapterFactory to PolymorphicJsonAdapterFactory
...
Also expand the documentation.
2018-10-20 00:47:48 -04:00
Jesse Wilson
1896e0f118
Merge pull request #697 from jocmp/master
...
Make RuntimeJsonAdapterFactory public
2018-10-19 23:33:06 -04:00
Jesse Wilson
ed5577b463
Merge pull request #712 from square/jwilson.1019.use_flatten
...
Don't decode into memory in RuntimeJsonAdapterFactory
2018-10-19 12:18:20 -04:00
Jesse Wilson
6125d8c7b1
Don't decode into memory in RuntimeJsonAdapterFactory
...
Instead use our new flatten API to decode directly to the stream.
2018-10-19 12:07:58 -04:00
Jesse Wilson
01a406eac9
Merge pull request #708 from square/jwilson.1013.flattening
...
JSON flattening.
2018-10-19 11:23:03 -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
Jesse Wilson
08bfedaeb2
Merge pull request #707 from square/jwilson.1009.streaming_RuntimeJsonAdapterFactory
...
Change RuntimeJsonAdapterFactory to peek for type names.
2018-10-13 20:43:53 -04:00
Jesse Wilson
24ac43a799
Change RuntimeJsonAdapterFactory to peek for type names.
...
This is a bit awkward because JsonReader.Options doesn't tell you
what its values are.
Also awkward because we don't yet have an equivalent to stream
the encode of the value.
2018-10-09 23:10:31 -04:00
Jesse Wilson
cfaf62c95f
Merge pull request #706 from square/eric.javadoc
...
Fix Javadoc code formatting for JsonReader.peek().
2018-10-08 15:54:57 -04:00
Eric Cochran
931673c264
Fix Javadoc code formatting for JsonReader.peek().
2018-10-08 12:48:44 -07:00
Jesse Wilson
2a4d37ece4
Merge pull request #704 from square/jwilson.1007.peekutf8
...
Implement peekJson() for JsonUtf8Reader
2018-10-08 12:27:02 -04:00
Jesse Wilson
01c45ca2a8
Merge pull request #705 from square/jwilson.1008.register_as_factory
...
Document how to register JsonAdapters
2018-10-08 12:24:17 -04: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
fe22970973
Document how to register JsonAdapters
...
Closes: https://github.com/square/moshi/issues/698
2018-10-08 11:14:57 -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
Jesse Wilson
10e2b77585
Merge pull request #703 from square/z/allow-other-processors
...
Allow other processors to process JsonClass
2018-10-06 12:40:15 -04:00
Zac Sweers
a34ca365f0
Allow other processors to process JsonClass
...
Someone at KotlinConf brought this to my attention, as they're trying to generate their own adapter factory but can't since moshi consumes the annotation and doesn't allow others.
2018-10-06 17:05:06 +02:00
Zac Sweers
bd2f2c4c28
Mention proguard 6 requirement ( #686 )
...
* Mention proguard 6 requirement
* Mention AGP instead
2018-09-29 22:59:52 -04:00
Zac Sweers
e0861cca57
Improve enum exception message ( #694 )
...
* Improve enum exception message
It is applicable to enums for proguard reasons, just not with code gen as well
* Update test message
2018-09-28 00:24:58 -04:00