* 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
Without the fix the test fails like so:
No JsonAdapter for T (with no annotations)
for T
for java.util.List<T>
for com.squareup.moshi.records.RecordsTest$IndirectGenerics<java.lang.Long>
for class com.squareup.moshi.records.RecordsTest$HasIndirectGenerics
java.lang.IllegalArgumentException: No JsonAdapter for T (with no annotations)
for T
for java.util.List<T>
for com.squareup.moshi.records.RecordsTest$IndirectGenerics<java.lang.Long>
for class com.squareup.moshi.records.RecordsTest$HasIndirectGenerics
at com.squareup.moshi.Moshi$LookupChain.exceptionWithLookupStack(Moshi.java:389)
at com.squareup.moshi.Moshi.adapter(Moshi.java:158)
at com.squareup.moshi.Moshi.adapter(Moshi.java:106)
at com.squareup.moshi.Moshi.adapter(Moshi.java:75)
R8 3.1 in full mode have made improvements to annotation removal.
Current rules are not enough to ensure that JsonQualifier annotatated class are kept.
See https://issuetracker.google.com/issues/206656057
* Update to KSP 1.0.1 and use new jvm modifiers resolver API
This allows us to fully support transient across compilation boundaries
* Copy in KSP-supported KCT for now
* Update CI refs
* Move up transient check to the right place
Wasn't actually looking at the added annotation later 🤧
* Try regular RC?
* Skip that matrix for now
* Default Json.name to an unset value
* Promote shared transient tests to DualKotlinTest
* Add new ignore property to Json
* Support it in ClassJsonAdapter
* Mention no enum/record support
* Support in KotlinJsonAdapter
* Rework code gen API to know of "ignored"
* Support in apt code gen
* Support in KSP
* Update old non-working transient example test
* Synthetic holders
* Use field on both
* Only assign setters if present
Rather than generating
```kotlin
val result: Content
result = Content()
result.content = if (contentSet) content else result.content
result.text = if (textSet) text else result.text
```
This will now conditionally set
```kotlin
val result: Content
result = Content()
if (contentSet) {
result.content = content
}
if (textSet) {
result.text = text
}
```
* Spotless