Snow-kal commented on code in PR #3171:
URL: https://github.com/apache/dubbo-go/pull/3171#discussion_r2719806746


##########
filter/generic/generalizer/map.go:
##########
@@ -54,10 +47,14 @@ type MapGeneralizer struct{}
 
 func (g *MapGeneralizer) Generalize(obj any) (gobj any, err error) {
        gobj = objToMap(obj)
+       if !getGenericIncludeClass() {
+               gobj = removeClass(gobj)
+       }
        return
 }
 
 func (g *MapGeneralizer) Realize(obj any, typ reflect.Type) (any, error) {
+       obj = removeClass(obj)

Review Comment:
   已经将无条件调用改为条件调用,保持和Generalize方法逻辑一致
   ```
   func (g *MapGeneralizer) Realize(obj any, typ reflect.Type) (any, error) {
        if !getGenericIncludeClass() {
                obj = removeClass(obj)
        }
        newobj := reflect.New(typ).Interface()
        err := mapstructure.Decode(obj, newobj)
        if err != nil {
                return nil, perrors.Errorf("realizing map failed, %v", err)
        }
   
        return reflect.ValueOf(newobj).Elem().Interface(), nil
   }
   ```
   



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