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
* Standardize around JDK 8
* Update GJF to support newer JDKs
* Fix misc java 8 issues in tests
* Prepare java 16/records checking at runtime
* Implement real RecordJsonAdapter
* Spotless
* Prepare build for JDK 16+
* Fix property name for kapt
* Small cleanup
* Make FallbackEnum java-8 happy
* Remove animalsniffer
* Fix format
* Add opens for ExtendsPlatformClassWithProtectedFields
* Return null every time in shim for main tests
* Use JDK 16 + release 8 to replace animalsniffer
* Simplify accessor accessible handling
* Remove manifest attrs
* Fix typo
* Fix KCT tests + upgrade it
* Cover another
* Try explicit kotlin daemon args for java 17?
* Disable 17-ea for now until kotlin 1.5.30
* Add JsonQualifier and Json(name) tests + fix qualifiers
* Ensure constructor is accessible
* GJF it properly
* GJF 1.11
* Unwrap InvocationTargetException
* Use MethodHandle for constructor
* Use MethodHandle for accessor too
* Revert "Remove manifest attrs"
This reverts commit 3eb768fd6904bb5c979aa01c3c182e0fb9329d62.
* Proper MR jar
* *actually* fix GJF, which wasn't getting applied before
We can just enable this everywhere now since we require JDK 16 anyway
* Make IDE happy about modules access
* Fixup records tests to play nice with modules
Gotta be public
* Add complex smoke test
* Remove comment
Not a regression test in this case