fix: 消除旧通知头空值重载歧义 - #4096
Conversation
🤖 Augment PR Summary摘要:本 PR 修复旧版电商通知头与新版通知头重载共存时,
🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Pull request overview
该 PR 针对 weixin-java-pay 电商收付通旧版通知解析兼容层,在引入旧 bean.ecommerce.SignatureHeader 重载后出现的 parse*NotifyResult(notifyData, null) 编译期重载歧义问题,通过建立类型继承关系来消除歧义,并补充回归验证以确保字段适配仍然正确。
Changes:
- 将旧
com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader调整为继承新com.github.binarywang.wxpay.bean.notify.SignatureHeader,使旧重载在null场景下成为更具体的匹配类型。 - 将新旧
SignatureHeader的 Lombok@Builder调整为@SuperBuilder以支持继承场景下的 builder。 - 在
LegacyEcommerceApiCompatibilityTest增加类型关系与字段映射的回归测试。
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/SignatureHeader.java | 将 @Builder 改为 @SuperBuilder,为旧类继承提供 builder 支持。 |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/SignatureHeader.java | 旧 SignatureHeader 继承新类型并保留旧字段,为重载消歧与字段适配铺路。 |
| weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/LegacyEcommerceApiCompatibilityTest.java | 新增回归测试验证继承关系与 signed/serialNo -> signature/serial 字段映射。 |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d8746e1b6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
背景
#4095 为旧版退款、提现通知解析添加
bean.ecommerce.SignatureHeader重载后,parse*NotifyResult(notifyData, null)因两个无关参数类型而出现编译期重载歧义。变更
bean.ecommerce.SignatureHeader继承新的bean.notify.SignatureHeadersigned、serialNo,并继续通过适配器映射到新的signature、serialnull调用不再二义验证
git diff --check