Commit Graph

1369 Commits

Author SHA1 Message Date
Valery Yatsynovich
804e830b3e [CI] Use built-in caching from setup-java action
https://github.com/actions/setup-java#caching-packages-dependencies:
> `setup-java` action has a built-in functionality for caching and restoring dependencies. It uses actions/cache under hood for caching dependencies but requires less configuration settings.
2023-01-23 01:59:05 +03:00
Zac Sweers
6f9223af8c Add more 1.14.0 changelog notes (#1575) 2022-09-06 23:41:39 -04:00
Jesse Wilson
c9f8c56efc Update changelog for 1.14.0 2022-09-06 14:36:42 -04:00
Michael Bailey
a6dd821990 Suppress warning in generated code (#1547) 2022-07-15 11:19:51 -04:00
Michael Bailey
27518bd4da Next version will be 2.x (#1552) 2022-06-29 09:17:07 -04:00
Zac Sweers
53bb46c208 Remove redundant opt-in flags (#1544)
* Remove "-opt-in=com.squareup.kotlinpoet.ksp.KotlinPoetKspPreview"

Unused now

* Remove redundant -opt-in=RequiresOptIn
2022-06-13 17:11:29 -04:00
Zac Sweers
e95af32df8 Update dependencies + Kotlin 1.7 + KotlinPoet 1.12.0 (#1543) 2022-06-13 17:02:27 -04:00
Zac Sweers
256d7b72aa Comment about KSP version (#1526) 2022-03-18 13:44:23 -04:00
Zac Sweers
fd128875c3 Remove a couple leftover TODOs (#1513) 2022-01-23 18:47:25 -05:00
Zac Sweers
2c9e3d036a Convert LinkedHashTreeMap to Kotlin (#1508)
* Initial pass at converting LinkedHashTreeMap to Kotlin

* Update tests as needed

* Remove Arrays use

* Separate find nullability

* Clean up a few expression bodies

* Various little cleanups and warnings

* Sprinkle in some knownNotNulls where useful

* add() is not implemented

* clean up some visibility and properties that can be fields

* Some minor formatting

* Some minor formatting
2022-01-23 18:03:25 -05:00
Zac Sweers
b2a67760d4 Explicitly denote util public APIs in japicmp (#1511) 2022-01-21 17:22:13 -05:00
Zac Sweers
c5e98e5be8 Small cleanups from a few past PRs (#1509) 2022-01-20 10:23:22 -05:00
Zac Sweers
c5be69a93c Tighten up visibility of APIs in Util.kt (#1510) 2022-01-20 10:22:52 -05:00
Spencer Griffin
9e5fc24f4f Convert ClassJsonAdapter to kotlin (#1470) 2022-01-19 00:25:06 -05:00
Spencer Griffin
57df98b9b1 Convert AdapterMethodsFactory.java to kotlin (#1467)
* Rename AdapterMethodsFactory from java to kt

* Convert AdapterMethodsFactory.java to AdapterMethodsFactory.kt

* Make kotlin more idiomatic

* Use forEach loop

* Spotless

* More idiomatic kotlin

* Inline toString

* Address comments from PR

* Address comments in PR review

* Spotless

* Use templated string for error message

* Add japicmp exclusion for internal AdapterMethodsFacotry#get method

* Convert if to when

* Convert if to when

* Use templated strings

* Replace forEach with for loop

* Simplify expression

* Add local val to avoid cast

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

Co-authored-by: Zac Sweers <pandanomic@gmail.com>

* Better variable names

* Exclude entire AdapterMethodsFactory class in japicmp

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

Co-authored-by: Zac Sweers <pandanomic@gmail.com>

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

Co-authored-by: Zac Sweers <pandanomic@gmail.com>

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

Co-authored-by: Zac Sweers <pandanomic@gmail.com>

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

Co-authored-by: Zac Sweers <pandanomic@gmail.com>

* Import knownNotNull

* Add requireNull in Util to create error message

* Rename argument

* Convert error message to raw string

* Use generateSequence to iterate through the superclasses

* Use it rather than complicated name

* Rename requireNull to checkNull, and remove contract

* Fix tests since error type changed

* Update moshi/src/main/java/com/squareup/moshi/internal/Util.kt

Co-authored-by: Spencer Griffin <sgriffin@ancestry.com>
Co-authored-by: Zac Sweers <pandanomic@gmail.com>
2022-01-18 22:45:42 -05:00
Zac Sweers
178a6858ff Switch fully over to dokka and fix accidental root project publishing (#1507) 2022-01-17 13:04:35 -05:00
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
e6081dc90e Skip nullchecks on known primitives (#1506) 2022-01-17 02:07:55 -05:00
Spencer Griffin
71c32934bf Convert ClassFactory.java to kotlin (#1469)
Co-authored-by: Spencer Griffin <sgriffin@ancestry.com>
2022-01-13 01:26:08 -05:00
Zac Sweers
ffaedac610 Don't suffix the value param when overriding (#1503) 2022-01-12 14:27:08 -05:00
Zac Sweers
1fdc61dc31 Update a few misc build deps (#1500) 2022-01-12 13:50:48 -05:00
Zac Sweers
9ac2ddf2db Finish up JsonWriter Kotlin conversion (#1501)
Co-authored-by: Zac Sweers <pandanomic@gmail.com>
Co-authored-by: Goooler <wangzongler@gmail.com>
2022-01-12 13:47:35 -05:00
Spencer Griffin
ff2f6e18d2 Convert ArrayJsonAdapter.java to kotlin (#1468)
Co-authored-by: Zac Sweers <pandanomic@gmail.com>
Co-authored-by: Spencer Griffin <sgriffin@ancestry.com>
2022-01-12 13:42:42 -05:00
Zac Sweers
396342b06b Convert RecordJsonAdapter to Kotlin (#1493) 2022-01-11 15:39:31 -05:00
Zac Sweers
d805ad1b5b Keep @FromJson/@ToJson-annotated methods in proguard (#1499) 2022-01-11 15:00:34 -05:00
Zac Sweers
1b582e4647 Convert JsonValueReader to Kotlin (#1487) 2022-01-11 13:29:16 -05:00
Zac Sweers
0a6565bb46 Convert JsonUtf8Writer to Kotlin (#1486) 2022-01-11 13:08:48 -05:00
Zac Sweers
ec3977160b Convert Types to Kotlin (#1488) 2022-01-11 12:55:33 -05:00
Sampath
8b30dacd1d Converted the read json list Java file to Kotlin (#1495) 2022-01-11 10:14:24 -05:00
Sampath
77645dee5c Update dokka to 1.6.10 (#1497) 2022-01-11 00:32:32 -05:00
Zac Sweers
156e9007fd Convert JsonValueSource to Kotlin (#1489)
* Rename .java to .kt

* Convert JsonValueSource to Kotlin
2022-01-10 12:23:09 -05:00
Zac Sweers
d7b70637d2 Convert MapJsonAdapter to Kotlin (#1492)
* Rename .java to .kt

* Convert MapJsonAdapter to Kotlin

* Pull up factory into companion object

* Spotless

* apicmp

* Use knownNotNull

* Use a template
2022-01-10 12:22:15 -05:00
Zac Sweers
31b7a11027 Inline Moshi extension functions to Moshi itself (#1496)
* Move inline extensions to Moshi(.Builder) directly

No need for the separation and it allows removing of the import

* Remove now-redundant imports
2022-01-10 12:22:02 -05:00
Zac Sweers
59afd4bb9b Convert JsonValueWriter to Kotlin (#1491)
* Rename .java to .kt

* Convert JsonValueWriter to Kotlin

* Use knownNotNull

* when of whens

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

* Nix the return

* Clean up

Co-authored-by: Parth Padgaonkar <1294660+JvmName@users.noreply.github.com>
2022-01-10 12:21:14 -05:00
Zac Sweers
6e81499501 Convert StandardJsonAdapters to Kotlin (#1494)
* Rename .java to .kt

* Convert StandardJsonAdapters to Kotlin

* Inline factory to object

* Idiomatic cleanups + japicmp

* Fixes

* Another idiomatatic bit

* Use knownNotNull() where applicable
2022-01-10 12:14:07 -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
6f8d690e6e Convert JsonScope to Kotlin (#1484)
* Rename .java to .kt

* Convert JsonScope to Kotlin

* Use buildString
2022-01-10 11:08:36 -05:00
Zac Sweers
2daf78337d Convert Collection adapter to Kotlin (#1485)
* Consolidate contract utils

* Rename .java to .kt

* Convert CollectionJsonAdapter to Kotlin

* Lift factory into companion object

* Update moshi/src/main/java/com/squareup/moshi/internal/Util.kt
2022-01-10 11:07:57 -05:00
Zac Sweers
32932cfb40 Convert exceptions to Kotlin (#1483)
* Rename .java to .kt

* Convert exceptions to kotlin

* Add missing empty constructor
2022-01-10 11:07:48 -05:00
Zac Sweers
56e1ae6404 Use Okio IOException in Kotlin classes (#1490)
More portability!
2022-01-07 21:02:16 -05:00
Sampath
50751a863a Latest version is 1.13.0 (#1482) 2022-01-07 13:14:24 -05:00
Sampath
846b9c3a45 EventJsonAdapter Kotlin sample update (#1481) 2022-01-07 10:44:18 -05:00
Vincent Stollenwerk
196ab7a132 Fix typo in README (#1480) 2022-01-06 17:26:10 -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
Zac Sweers
e5e4c48767 Convert Moshi annotations to Kotlin (#1472) 2022-01-03 13:53:56 -05:00
Zac Sweers
82cf56ab76 Fix javadoc task and snapshots (#1474)
The javadoc task assumes every doc starts with h1 and thus using them anywhere in the body after the start is an error ¯\_(ツ)_/¯. This just changes them to h2
2021-12-26 17:55:43 -06:00
Zac Sweers
f0b886f129 Fix exhaustive when in JsonUtf8Reader (#1473)
* Fix exhaustive when in JsonUtf8Reader

This accidentally snuck into master because it predates the Kotlin 1.6 upgrade

* Fix nextInt too

* Clean up a few little warnings opportunistically

* Fix comment

* Use knownNotNull
2021-12-26 17:07:52 -06:00
Parth Padgaonkar
c49daf907b JsonUtf8Reader --> Kt (#1400)
* initial attempt

* passing tests

* cleanup

* Apply suggestions from code review

Co-authored-by: Jake Wharton <github@jakewharton.com>

* split `also` to two lines

* remove !! and labels

* spotless

* Apply suggestions from code review

Co-authored-by: Jake Wharton <github@jakewharton.com>

* clean up a few more things

* pull duplicated code into an inline fun

* missed one

* refactor double field evaluation to inline fun

* spotless

* Apply suggestions from code review

Co-authored-by: Jake Wharton <github@jakewharton.com>

* var -> val

Co-authored-by: Jake Wharton <github@jakewharton.com>
2021-12-26 16:05:55 -06:00
Zac Sweers
f3d2103ffb Convert Moshi.java to Kotlin (#1462)
* Rename .java to .kt

* Migrate Moshi.java to Moshi.kt

* Idiomatic cleanups

* Move comments down

* Apply suggestions from code review

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

* Small little cleanups

Co-authored-by: Egor Andreevich <egor@squareup.com>
2021-12-26 15:49:52 -06:00