zrlw opened a new issue #8965:
URL: https://github.com/apache/dubbo/issues/8965


   ### Environment
   
   * Dubbo version: 3.0
   ```
   Expected: 
"java.util.Map<java.lang.String,org.apache.dubbo.metadata.definition.protobuf.model.GooglePB$PhoneNumber>"
        but: was 
"java.util.Map<java.lang.String,org.apache.dubbo.metadata.definition.protobuf.model.GooglePB.PhoneNumber>"
        at 
org.apache.dubbo.metadata.definition.protobuf.ProtobufTypeBuilderTest.testProtobufBuilder(ProtobufTypeBuilderTest.java:73)
   ```
   
github日志:https://github.com/apache/dubbo/runs/3742803685?check_suite_focus=true
   
   1、ProtobufTypeBuilderTest测试类代码不太对:
   ```
           assertThat(getTypeName(propertiesMap.get("phone"), types),
                   
equalTo("java.util.List<org.apache.dubbo.metadata.definition.protobuf.model.GooglePB.PhoneNumber>"));
           assertThat(getTypeName(propertiesMap.get("doubleMap"), types),
                   
equalTo("java.util.Map<java.lang.String,org.apache.dubbo.metadata.definition.protobuf.model.GooglePB$PhoneNumber>"));
   ```
   
PhoneNumber作为GooglePB的静态嵌套类,用在list时断言是GooglePB.PhoneNumber类型名称,用在map时断言就变成了GooglePB$PhoneNumber名称,名字变来变去不合适吧。
   
   2. MapTypeBuilder的build方法不太对
   这里不讨论#8212 #5122 派生MAP类型的问题,要说的是这行代码:
   ```String mapType = type.toString();```
   type是嵌套类时,toString的结果是binary 
name,也就是x.x.x$y这种$分隔的样子,但是纵观ProtobufTypeBuilder的build和buildProtobufTypeDefinition都clazz.getCanonicalName()取的canonical
 Name,这样MapTypeBuilder构造的type名称和里面的item名称不一致,各个item的名称都是canonical 
name(小数点分隔的样子)。
   
   ProtobufTypeBuilderTest为啥偶尔会爆断言失败的原因我还没有找到,但是我觉得统一静态嵌套类的名称还是必要的。
   


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