You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by "chaokunyang (via GitHub)" <gi...@apache.org> on 2026/09/21 03:49:09 UTC

[PR] fix(json): correct Scala codecs and Scala/Kotlin missing-field defaults [fory]

chaokunyang opened a new pull request, #4072:
URL: https://github.com/apache/fory/pull/4072

   ## Why?
   
   Several documented Scala JSON values cannot be written, and the shared generic recursion guard rejects finite types such as `Box<Box<Integer>>`. Missing constructor properties also need useful language defaults while preserving Kotlin's non-null reference constraints.
   
   ## What does this PR do?
   
   - Default omitted Scala constructor parameters to `None`, numeric zero, `false`, fresh empty collections/arrays, or `null` as appropriate. Explicit constructor defaults take precedence.
   - Default omitted Kotlin non-null scalars to zero/false and nullable parameters to null. Explicit defaults still apply; non-null references without defaults, such as `val name: String`, remain required.
   - Support `ScalaTypeRef[Unit]` and nested Unit occurrences through the existing JSON null representation. Java `void` root writes remain rejected, and `Some(())` retains the documented value-or-null Option representation.
   - Fix populated immutable Queue, primitive mutable ArraySeq, specialized Tuple1/Tuple2, Duration.Undefined, and primitive generic case-class codegen writes.
   - Accept finite nested instantiations of the same generic class while continuing to reject expanding recursive declarations. Generated readers/writers distinguish the complete child schema from self references, and generated class keys preserve that distinction.
   - Support parameterless Scala 3 enum keys in typed Scala maps. Reject unsupported case-class constructors through the Scala model instead of silently losing fields in the ordinary object path.
   - Complete the relevant coverage from #4067 across generated/interpreted operations, String/UTF-8 readers and writers, constructor shapes, collection implementations, enum keys, and generic types; update the Scala and Kotlin guides.
   
   ## Validation
   
   - Java JSON focused regression suites: 293 passed (`JsonContainerTest`, `JsonCreatorTest`, `JsonModuleTest`, `JsonGeneratedCapabilityKeyTest`, `JsonAnyPropertyTest`, `JsonUnwrappedTest`).
   - Scala JSON suites: 82 passed on Scala 2.13.18; 92 passed on Scala 3.3.8.
   - Kotlin JSON suite: 122 passed on Kotlin 2.3.20.
   - Java Spotless/Checkstyle, Kotlin Spotless, Markdown Prettier, and `git diff --check` passed.
   - Local runtime validation used GraalVM JDK 21.0.11 in JVM mode. Native-image execution was not run locally.
   
   ## Related issues
   
   Fixes #4067
   Fixes #4068
   Fixes #4069
   
   ## Does this PR introduce any user-facing change?
   
   Missing Scala properties now use constructor or type defaults. Missing Kotlin properties use explicit defaults first, then zero/false for non-null scalars or null for nullable types. Kotlin non-null references still reject missing values. The previously failing Scala values and finite nested generic types now work as documented. No binary protocol change.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [PR] fix(json): correct Scala codecs and Scala/Kotlin missing-field defaults [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang merged PR #4072:
URL: https://github.com/apache/fory/pull/4072


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org