You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/30 03:03:22 UTC

[GitHub] [dubbo] zrlw opened a new issue #8965: [3.0] ProtobufTypeBuilderTest单元测试doubleMap类型断言有时失败

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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw commented on issue #8965: [3.0] ProtobufTypeBuilderTest单元测试doubleMap类型断言有时失败

Posted by GitBox <gi...@apache.org>.
zrlw commented on issue #8965:
URL: https://github.com/apache/dubbo/issues/8965#issuecomment-930752662


   MapTypeBuilder的type.toString()已改ClassUtils.getCanonicalNameForParameterizedType(parameterizedType),ProtobufTypeBuilderTest的doubleMap类型断言没有同步改成GooglePB.PhoneNumber的缘故。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw closed issue #8965: [3.0] ProtobufTypeBuilderTest单元测试doubleMap类型断言有时失败

Posted by GitBox <gi...@apache.org>.
zrlw closed issue #8965:
URL: https://github.com/apache/dubbo/issues/8965


   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] zrlw edited a comment on issue #8965: [3.0] ProtobufTypeBuilderTest单元测试doubleMap类型断言有时失败

Posted by GitBox <gi...@apache.org>.
zrlw edited a comment on issue #8965:
URL: https://github.com/apache/dubbo/issues/8965#issuecomment-930752662


   MapTypeBuilder的type.toString()已改ClassUtils.getCanonicalNameForParameterizedType(parameterizedType),ProtobufTypeBuilderTest的doubleMap类型断言没有同步改成GooglePB.PhoneNumber的缘故。
   #8807


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org