Commit Graph

8 Commits

Author SHA1 Message Date
Zac Sweers
47697c2601 Convert JsonReader to Kotlin (#1505)
* Rename .java to .kt

* Convert JsonReader to Kotlin

Made it sealed along the way like JsonWriter

Some of the properties had different docs for setting and getting, which dokka doesn't seem to have a nice way to differentiate. Went with a little marked up form but open to suggestions.

* Restore isLenient name to lenient

This plays nice for both java and kotlin consumers, as it's still isLenient to java consumers but not a source breaking change for kotlin

* Fix peek nullability and a kotlin source change

* Fix another nullability

* Use collection builders

* Ok this didn't work quite as I expected

* Update moshi/src/main/java/com/squareup/moshi/JsonReader.kt

Co-authored-by: Parth Padgaonkar <1294660+JvmName@users.noreply.github.com>

Co-authored-by: Parth Padgaonkar <1294660+JvmName@users.noreply.github.com>
2022-01-17 02:52:02 -05:00
Zac Sweers
323d97c787 Convert JsonAdapter to Kotlin (#1475)
* Rename .java to .kt

* Convert JsonAdapter to Kotlin

Note that there's more to be done here I think, namely exploring removing the NonNull adapter and making the nullSafe() adapter public so that nullability is directly in the API. Saving that for another day though

* Update a couple usages

* Fix override

* Add exclusion for open

* Add `@Language` annotation for json strings

Allows the IDE to automatically make this pretty

* Spotless

* Nullable

Co-authored-by: Egor Andreevich <egor@squareup.com>

* When

Co-authored-by: Parth Padgaonkar <1294660+JvmName@users.noreply.github.com>

* Another when

* Spotless

Co-authored-by: Egor Andreevich <egor@squareup.com>
Co-authored-by: Parth Padgaonkar <1294660+JvmName@users.noreply.github.com>
2022-01-10 11:29:37 -05:00
Zac Sweers
56e1ae6404 Use Okio IOException in Kotlin classes (#1490)
More portability!
2022-01-07 21:02:16 -05:00
Zac Sweers
484d525db4 Convert adapters to Kotlin (#1460)
* Convert Rfc3339DateJsonAdapter

* Convert EnumJsonAdapter

* Convert PolymorphicJsonAdapterFactory

* Convert Rfc3339DateJsonAdapter and Iso8601Utils

* Doc indent fix

* Use template

* Address CR comments

* Spotless and jsr cleanup

* Couple small tweaks

* Remove toList()

* Use simpler map

* Inline GregorianCalendar

* Interp

* Fix copyright

* interp

* Fix another copyright

* Restore toList()
2022-01-06 15:15:48 -05:00
Zac Sweers
e2c346e1de Convert util package to Kotlin (#1461)
* Rename .java to .kt

* Convert NonNullJsonAdapter

* Rename .java to .kt

* Convert NullSafeJsonAdapter

* Fix missing null-check

* Rename .java to .kt

* Convert Util (initial pass)

* Push to top-level Util

* Use extensions and properties where possible

* Use knownNotNull

* Spotless

* Clean up impl type classes a bit

* Update code gen

* Use extension for resolving

* Spotless

* Fix master conflicts

* Rename to toStringWithAnnotations()

* for (t in args.indices) {

* for (i in interfaces.indices) {

* Template
2022-01-06 14:54:13 -05:00
Egor Andreevich
ae421b1909 Move repo uploads to S01 (#1471) 2021-12-23 11:44:24 -05:00
Zac Sweers
2e15a3fa72 Update moshi version used for japicmp (#1459) 2021-12-12 04:03:03 -05:00
Jesse Wilson
7578984f25 Change the directory structure to match our modules (#1451) 2021-12-08 23:52:51 -05:00