Commit graph

78 commits

Author SHA1 Message Date
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
Jesse Wilson
9ea1f845a8 Generate Kotlin documentation with Dokka 2018-08-14 20:20:15 -04:00
Jesse Wilson
34f8f9472f
Merge pull request #612 from square/jwilson.0805.extension_property
Test to confirm that extension properties are not encoded or decoded
2018-08-06 04:36:34 -04:00
Jesse Wilson
9251309c3f
Merge pull request #603 from square/eric.patch-1
Simplify Options initializer generation.
2018-08-05 22:36:29 -04:00
Jesse Wilson
c360a1c840 Test to confirm that extension properties are not encoded or decoded 2018-08-05 22:20:25 -04:00
Eric Cochran
248be5805b Fix dollar sign escaping for json key names. 2018-07-24 18:03:23 -07:00
Eric Cochran
6bb83abf84
Simplify Options initializer generation. 2018-07-24 17:51:18 -07:00
Zac Sweers
78821bbc80 Update to KotlinPoet 1.0.0-RC1 (#599)
* Update to kotlinpoet 1.0.0-RC1

* Move to WildcardTypeName.STAR

* simpleNames() function -> simpleNames property

* packageName() fun -> packageName property

* simpleName() fun -> simpleName property

* Check if bounds are empty for TypeVariableName. If so, use no-bounds creator

* Use new parameterizedBy/plusParameter API where appropriate
2018-07-17 22:44:20 -04:00
Zac Sweers
c9aee2e853 Fix GeneratedAnnotation member definition
Before this was just adding both as varargs of "value"
2018-06-15 22:09:13 -07:00
Eric Cochran
4666e06910 Allow private transient Kotlin properties. 2018-06-06 17:12:29 -07:00
Zac Sweers
3ecdfb6374 Fix generic typealiases (#551)
* Add generic type alias

* Fix missing resolveAliases check to fix generics

* Reword to useAbbreviatedType
2018-05-17 22:06:43 -04:00
Zac Sweers
b956b06f6d Fix companion object names not being resolved (#549)
* Fix companion object names not being resolved

This slipped through the cracks before the release

Fixes #546

* Add braces on the else clause for symmetry
2018-05-16 15:44:07 -04:00
Jesse Wilson
03f17310bc Fix the link to the parent pom.xml in kotlin/reflect 2018-05-16 14:43:38 -04: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
0b26628232
Merge pull request #536 from square/jwilson.0514.cast_shade
Shade unreleased KotlinPoet 0.7.0.
2018-05-14 22:52:35 -04:00
Jesse Wilson
b857388796 Shade unreleased KotlinPoet 0.7.0.
That way we won't collide with other annotation processors if they have an
incompatible version.
2018-05-14 22:40:29 -04:00
Jesse Wilson
dd3043722e Generated adapters should use skipName(), not nextName(). 2018-05-14 22:39:33 -04:00
Jesse Wilson
dd84b9f8f8 Change the Kotlin reflection adapter to yield to the codegen adapter 2018-05-14 21:07:46 -04:00
Jesse Wilson
60cb608956 Move Kotlin reflection into a kotlin/reflect directory
The maven coordinates stay the same.
2018-05-14 17:28:28 -04:00
Jesse Wilson
9f69029ef0 Move the Kotlin code generator to the kotlin/ module 2018-05-14 16:29:52 -04:00
Jesse Wilson
13952c5430 Finish migrating tests from the reflective adapter 2018-05-13 21:52:06 -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
c35e3a1550 Fix some tests that have the wrong expected exception message
The message got improved in a conflicting change to these tests being added.
2018-05-04 15:39:55 -04:00