* 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>
* Rename .java to .kt
* Convert MapJsonAdapter to Kotlin
* Pull up factory into companion object
* Spotless
* apicmp
* Use knownNotNull
* Use a template
* Rename .java to .kt
* Convert StandardJsonAdapters to Kotlin
* Inline factory to object
* Idiomatic cleanups + japicmp
* Fixes
* Another idiomatatic bit
* Use knownNotNull() where applicable
* 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>
* 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
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
* 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
* 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>
Whoever thought this was a good idea is wrong.
> Task :moshi:javadoc
/home/runner/work/moshi/moshi/moshi/src/main/java/com/squareup/moshi/JsonWriter.java:40: error: heading used out of sequence: <H3>, compared to implicit preceding heading: <H1>
* <h3>Encoding JSON</h3>
^
/home/runner/work/moshi/moshi/moshi/src/main/java/com/squareup/moshi/JsonReader.java:40: error: heading used out of sequence: <H3>, compared to implicit preceding heading: <H1>
* <h3>Parsing JSON</h3>
^
* Switch to the Vanniktech base plugin for publishing
Move configuration out of build.gradle files and into build.gradle.kts files.
Sign published builds.
Support publishing release builds from GitHub actions.
* Update build.gradle.kts
Co-authored-by: Zac Sweers <zac.sweers@gmail.com>
Co-authored-by: Zac Sweers <zac.sweers@gmail.com>
Without this fix the new test fails like this:
value of: toJson(...)
expected: {"$a":"apple","$b":"banana"}
but was : {"${'$'}a":"apple","$b":"banana"}
* Rename to unwrapTypeAliasInternal + simplify
* Move down isAnyNullable
* Make dynamic explicit
* Clean up supertypes doc and filtering
* Switch to invoke extensions
* Just best guess the annotation
* Clean up redundant sequence and use a regular loop
* element -> type
* supertypes -> superclasses
* Spotless
* Fix copyright
* Add multiple messages check
* Link issue
Co-authored-by: Jesse Wilson <jesse@swank.ca>
Without this we get an AssertionError, which is the wrong exception
type for a JSON schema mismatch:
java.lang.AssertionError: java.lang.NullPointerException: Cannot invoke "java.lang.Number.intValue()" because the return value of "sun.invoke.util.ValueConversions.primitiveConversion(sun.invoke.util.Wrapper, Object, boolean)" is null
at com.squareup.moshi.RecordJsonAdapter.fromJson(RecordJsonAdapter.java:168)
at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:41)
at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:70)
at com.squareup.moshi.records.RecordsTest.absentPrimitiveFails(RecordsTest.java:257)
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Number.intValue()" because the return value of "sun.invoke.util.ValueConversions.primitiveConversion(sun.invoke.util.Wrapper, Object, boolean)" is null
at java.base/sun.invoke.util.ValueConversions.unboxInteger(ValueConversions.java:81)
at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
at com.squareup.moshi.RecordJsonAdapter.fromJson(RecordJsonAdapter.java:156)
... 46 more