Commit graph

680 commits

Author SHA1 Message Date
Zac Sweers
ded3bccc60 Some miscellaneous kotlinpoet updates (#786)
* KotlinPoet 1.0.1

* Nix asNullableIf in favor of plain copy() function use

* Add a test for packages that look like classes

Resolves #783
2019-01-13 10:18:00 -05:00
Jesse Wilson
3588c98b86
Merge pull request #778 from square/z/defaultValue
Add support for default values in PolymorphicJsonAdapterFactory
2018-12-31 22:04:07 -05:00
Zac Sweers
fead71bca0 Add support for default values in PolymorphicJsonAdapterFactory
Picking from #741
Resolves #739
2018-12-31 16:21:57 -08:00
Zac Sweers
5153295988
Merge pull request #771 from square/z/removeRelocation
Remove shading of KotlinPoet
2018-12-11 19:35:47 -08:00
Zac Sweers
e6de367369 Remove shading of KotlinPoet
Resolves #770
2018-12-11 16:19:29 -08:00
Jesse Wilson
9f6197b67c
Merge pull request #769 from Egorand/egorand/181210/kotlinpoet-1.0.0
KotlinPoet 1.0.0
2018-12-11 11:05:12 -05:00
Egor Andreevici
6393692926 KotlinPoet 1.0.0 2018-12-10 19:59:37 -05:00
Erik Huizinga
85e86f1fa8 Add section about null safety (#757)
* Add section about null safety

Null safety is an important feature of the Kotlin language.
The fact that Moshi supports wrapping existing adapters in a null safe or non-null variant is important for null safety.
Therefore it makes sense to promote this feature in the readme, as this is one of the first places people should look for support and such features.

* Move factory method section out of Kotlin section

* Fix syntax highlighting

* Remove isLenient() reference

* Rewrite Kotlin example as Java, reformat comments
2018-12-03 22:50:52 -05:00
Jesse Wilson
2e241bff6f
Merge pull request #764 from square/jwilson.1128.kp10rc3
Upgrade to KotlinPoet 1.0-RC3
2018-11-29 07:03:27 -05:00
Jesse Wilson
ca4d8f5e34 Upgrade to KotlinPoet 1.0-RC3 2018-11-28 22:20:07 -05:00
Jesse Wilson
a2b39e29e8
Merge pull request #760 from square/eric.toJsonCoercesRuntimeTypeForMaps
Unignore ObjectAdapterTest's toJsonCoercesRuntimeTypeForMaps.
2018-11-27 21:48:38 -05:00
Eric Cochran
737f58cecb
Unignore ObjectAdapterTest's toJsonCoercesRuntimeTypeForMaps 2018-11-26 17:04:40 -08:00
Artem Daugel-Dauge
9aaef1f6f8 Treat warnings as errors in moshi-kotlin tests (#730)
* Fix/supress warnings in tests

* Treat kotlinc warnings as errors in tests
2018-11-23 22:24:19 -05:00
Jesse Wilson
2265f5e9b8
Merge pull request #755 from square/z/removesudo
Remove sudo: false from travis config
2018-11-23 22:22:24 -05:00
Zac Sweers
22259af1d1
Remove sudo: false from travis config
https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration
2018-11-23 19:12:30 -08:00
Zac Sweers
1f2a9373b7
Merge pull request #754 from square/z/kotlinTypesFollowup
Use faster isAnnotationPresent check
2018-11-20 17:51:59 -08:00
Zac Sweers
dbe7bfa15f Use faster isAnnotationPresent check
Followup from https://github.com/square/moshi/pull/749#discussion_r235224202
2018-11-20 17:20:09 -08:00
Jesse Wilson
afb82cb3e8
Merge pull request #751 from square/eric.platform-type
Improve error message for platform types.
2018-11-20 20:05:13 -05:00
Zac Sweers
c64138bf0a
Refuse kotlin classes in ClassJsonAdapter (#749)
* Refuse kotlin classes in ClassJsonAdapter

* Fail()

* Tweak message
2018-11-19 23:36:52 -08:00
Zac Sweers
4550da0abe
Merge pull request #750 from square/eric.tests
Fix KotlinJsonAdapter tests that were missing the factory.
2018-11-19 23:27:31 -08:00
Jake Wharton
f4f7c656bd
Merge pull request #752 from square/eric.p
Fix peekJson Javadoc paragraph formatting.
2018-11-19 13:46:49 -05:00
Eric Cochran
7d1657d76c
Fix peekJson Javadoc paragraph formatting. 2018-11-19 10:42:41 -08:00
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
Eric Cochran
1f46203285
Fix KotlinJsonAdapter tests that were missing the factory. 2018-11-19 01:58:25 -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