Commit graph

102 commits

Author SHA1 Message Date
Jake Wharton
bcb6fd4a4d Don't wrap between throw and exception type 2019-04-10 10:28:30 -04:00
Oliver Bestmann
3994723c3c Use StringBuilder to deduplicate String constants 2019-04-02 11:49:40 -04:00
Eric Cochran
3e848c0cdd Use KotlinPoet's MemberName for emptySet import. (#818)
* Update to KotlinPoet 1.1.0.

* Use KotlinPoet's MemberName for emptySet import.
2019-03-14 02:57:08 -07:00
Eric Cochran
13a40edf5b
Correct error for duplicate JSON key for Kotlin. (#789)
Before, the KotlinJsonAdapter threw "java.lang.IndexOutOfBoundsException: Index: 0, Size: 0" on a duplicate key when the key matched a property that was not a constructor parameter.
2019-02-15 11:18:50 -08:00
Eric Cochran
e04c80c1c6
Remove old TODO after KotlinPoet fix. (#790) 2019-02-15 11:15:02 -08:00
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
Zac Sweers
e6de367369 Remove shading of KotlinPoet
Resolves #770
2018-12-11 16:19:29 -08:00
Egor Andreevici
6393692926 KotlinPoet 1.0.0 2018-12-10 19:59:37 -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
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
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
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
Eric Cochran
38b08f81e6
Fix test for null-safe KotlinJsonAdapterFactory adapters. 2018-11-17 02:23:28 -08: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
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
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
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
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
Jesse Wilson
a5d35730de Don't use @Language when the literal includes a dollar sign
It makes IntelliJ grumpy.
https://youtrack.jetbrains.com/issue/KT-27224
2018-09-27 09:45:44 -04:00
Jesse Wilson
705ddc24e3
Merge pull request #687 from hzsweers/z/removeExtensions
Completely remove companion object jsonAdapter extension function gen
2018-09-25 07:08:54 -04:00
Eric Cochran
526717ec36
Remove duplicate kotlin-metadata version declaration.
The version is already defined in the root.
2018-09-25 00:17:32 -07:00
Zac Sweers
86c8671d64 Completely remove companion object jsonAdapter extension function gen
It's broken currently (see #611), and after talking with @swankjesse decided it's best to just nix this API
2018-09-25 00:58:52 -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
735f0c39f7 Upgrade Kotlin, AssertJ, compile-testing, and kotlin-metadata dependencies 2018-09-24 21:48:25 -04:00
Eric Cochran
242b7b1055 Use the adapter lookup hint API in Kotlin codegen adapters. 2018-09-20 21:00:18 -07:00
Jesse Wilson
1ba25ef3f9
Merge pull request #660 from square/eric.fix-preemptive-null-check
Allow user adapters to convert null to non-null in codegen.
2018-09-20 23:36:40 -04:00
Eric Cochran
05cfb77430
Use the adapter lookup hint API in the Kotlin reflection adapter. 2018-09-18 18:00:22 -07:00
Eric Cochran
8e151b1df3 Allow user adapters to convert null to non-null in codegen.
Delegate to installed adapters instead of checking for null.
2018-09-11 22:25:42 -07:00
Jesse Wilson
c04f1bafde Don't do Kotlin reflection on a non-Kotlin class.
Closes: https://github.com/square/moshi/issues/662
2018-09-11 21:50:02 -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
c008e0e2b6 Test support for uppercase property names
I couldn't reproduce the reported issue.

Closes: https://github.com/square/moshi/issues/574
2018-09-09 23:25:56 -04:00
Jesse Wilson
1ba07d4b7d Test that @Transient private properties are ignored
Closes: https://github.com/square/moshi/issues/643
2018-09-09 23:17:50 -04:00
Jesse Wilson
cb86194f8f
Merge pull request #651 from square/jwilson.0909.enclosed_parameterized
Call Types.newParameterizedTypeWithOwner when necessary.
2018-09-09 23:16:38 -04:00
Jesse Wilson
306664fb6a Call Types.newParameterizedTypeWithOwner when necessary.
Otherwise we crash with an exception attempting to create an adapter
for an enclosed type that has a type parameter.

I ran into this looking for a test case for issue 615.
https://github.com/square/moshi/issues/615
2018-09-09 17:05:33 -04:00
Jesse Wilson
7382145318 Change DelegateKey to use AnnotationSpec instead of AnnotationMirror
AnnotationSpec implements equals() in the way we need, but
AnnotationMirror doesn't. As a consequence this fixes a problem
where we were generating redundant adapters.

Closes: https://github.com/square/moshi/issues/563
2018-09-09 15:27:21 -04:00
Jesse Wilson
f5fe86dd78 Confirm you can use codegen with adapter methods
We had a bug report that said using just @ToJson wasn't working.
This test attempts to show it should work just fine.

https://github.com/square/moshi/issues/545
2018-09-09 12:16:18 -04: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
597da2d861
keep BuiltInsLoaderImpl for kotlin reflect artifact 2018-08-24 10:47:22 +02:00
Jesse Wilson
354db6b46f
Merge pull request #627 from square/eric.2018-08-17.boxed-primitive-adapters
Make nullable primitives in codegen use boxed type adapters.
2018-08-19 07:36:12 -04:00
Gabriel Ittner
4bbc5b2ff8
Embed ProGuard rules in the jar 2018-08-19 11:14:47 +02:00
Eric Cochran
1b17423343 Make nullable primitives in codegen use boxed type adapters. 2018-08-17 13:41:43 -07:00