mandrean opened a new pull request, #3733: URL: https://github.com/apache/fory/pull/3733
<!-- **Thanks for contributing to Apache Fory™.** **If this is your first time opening a PR on fory, you can refer to [CONTRIBUTING.md](https://github.com/apache/fory/blob/main/CONTRIBUTING.md).** Contribution Checklist - The **Apache Fory™** community has requirements on the naming of pr titles. You can also find instructions in [CONTRIBUTING.md](https://github.com/apache/fory/blob/main/CONTRIBUTING.md). - Apache Fory™ has a strong focus on performance. If the PR you submit will have an impact on performance, please benchmark it first and provide the benchmark result here. --> ## Why? When Scala is present on the runtime classpath, Java compatible serializers enable Scala default-value support globally. Plain Java classes generated with Lombok `@Builder.Default` can contain private helper methods named like `$default$imageRelations()`, which previously matched the broad Scala default-method scan and caused warning noise during deserialization. ## What does this PR do? - Restricts Scala default-value method detection to known Scala constructor/apply helper prefixes with numeric parameter suffixes. - Ignores non-Scala/Lombok-style `$default$` helper names and out-of-range parameter indexes without invoking them. - Keeps Scala case-class and regular-class constructor defaults working, including nested/default-value regression coverage. - Adds Java fixtures and Scala serializer tests covering Lombok-like helper methods. ## Related issues Closes #3720 ## AI Contribution Checklist <!-- Full requirements and disclosure template: https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs --> - [x] Substantial AI assistance was used in this PR: `no` - [ ] If `yes`, I included a completed [AI Contribution Checklist](https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs) in this PR description and the required `AI Usage Disclosure`. - [ ] If `yes`, my PR description includes the required `ai_review` summary and screenshot evidence of the final clean AI review results from both fresh reviewers on the current PR diff or current HEAD after the latest code changes. <!-- If substantial AI assistance = `yes`, paste the completed checklist and disclosure block here, including the final ai_review summary and screenshot evidence from both fresh reviewers on the current PR diff or current HEAD after the latest code changes. --> ## Does this PR introduce any user-facing change? <!-- If any user-facing interface changes, please [open an issue](https://github.com/apache/fory/issues/new/choose) describing the need to do so and update the document if necessary. Delete section if not applicable. --> - [ ] Does this PR introduce any public API change? - [ ] Does this PR introduce any binary protocol compatibility change? ## Benchmark N/A. This is a targeted default-method filtering fix and does not change serialization format or hot-path serialization logic. ## Validation - `JAVA_HOME=/Users/mandrean/.sdkman/candidates/java/21.0.5-tem PATH=/Users/mandrean/.sdkman/candidates/java/21.0.5-tem/bin:/Users/mandrean/.sdkman/candidates/maven/current/bin:$PATH mvn -s /Users/mandrean/.sdkman/candidates/maven/current/conf/settings.xml -T16 -pl fory-core -am install -DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip=true` - `JAVA_HOME=/Users/mandrean/.sdkman/candidates/java/21.0.5-tem PATH=/Users/mandrean/.sdkman/candidates/java/21.0.5-tem/bin:/Users/mandrean/.sdkman/candidates/maven/current/bin:$PATH mvn -s /Users/mandrean/.sdkman/candidates/maven/current/conf/settings.xml -pl fory-core -Dtest=org.apache.fory.platform.AndroidSupportStaticCheckTest#testScalaDefaultValuesDoNotUseTrustedLookupOnAndroid test` - `JAVA_HOME=/Users/mandrean/.sdkman/candidates/java/21.0.5-tem PATH=/Users/mandrean/.sdkman/candidates/java/21.0.5-tem/bin:$PATH java -Duser.language=en -Duser.country=US -jar /tmp/sbt-launch-1.9.9.jar '+testOnly org.apache.fory.util.ScalaDefaultValueUtilsTest org.apache.fory.serializer.scala.ScalaDefaultValueTest'` - `JAVA_HOME=/Users/mandrean/.sdkman/candidates/java/21.0.5-tem PATH=/Users/mandrean/.sdkman/candidates/java/21.0.5-tem/bin:$PATH java -Duser.language=en -Duser.country=US -jar /tmp/sbt-launch-1.9.9.jar '+test'` - `JAVA_HOME=/Users/mandrean/.sdkman/candidates/java/21.0.5-tem PATH=/Users/mandrean/.sdkman/candidates/java/21.0.5-tem/bin:/Users/mandrean/.sdkman/candidates/maven/current/bin:$PATH mvn -s /Users/mandrean/.sdkman/candidates/maven/current/conf/settings.xml -T16 spotless:check checkstyle:check` -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
