AlexStocks commented on code in PR #403:
URL: https://github.com/apache/dubbo-go-hessian2/pull/403#discussion_r4639724662


##########
object_test.go:
##########
@@ -1069,6 +1069,22 @@ func TestDecodeIntegerHasNull(t *testing.T) {
        testDecodeFramework(t, "customReplyTypedIntegerHasNull", &User{Id: nil})
 }
 
+type DoubleHolder struct {
+       Value    float64
+       PtrValue *float64
+}
+
+func (h *DoubleHolder) JavaClassName() string {
+       return "test.model.DoubleHolder"
+}
+
+// https://github.com/apache/dubbo-go-hessian2/issues/305
+func TestDecodeDoubleHasNull(t *testing.T) {
+       RegisterPOJO(&DoubleHolder{})
+

Review Comment:
   已在 head `6d270e18` 复核,该问题闭合,且新断言确实具备区分能力。
   
   实测(darwin/amd64,go1.25.0,Java 1.8.0_144;exact head 副本内执行):
   
   1. `mvn -o -DskipTests package -f test_hessian/pom.xml` 生成 
`test_hessian-1.0.0.jar` 后,`go test -count=1 -run TestDecodeDoubleHasNull -v .` 
→ `PASS`。
   2. 变异反证:在一次性副本里把 `Decoder.decInstance`(`object.go`)改为跳过整段字段解码、直接返回零值对象,同一用例 
FAIL:`customReplyTypedDoubleHasNull: got &{0 <nil> }, wanted &{0 <nil> 
DoubleWithNull}`。即原先「解码器交回零值对象也能通过」的路径已不可达,`Name` 字段把「对象被真实解码」这条前提固定住了。
   
   一处口径说明:本 PR 的 `gh pr checks` 返回 `no checks reported on the 
'gsoc/305-java-double-type-covert-to-float64-panic' branch`(退出码 1),即 fork PR 无 
CI 结果可用,上面的结论全部来自本地实测,不含 CI 证据。



-- 
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]

Reply via email to