AlbumenJ commented on code in PR #13155:
URL: https://github.com/apache/dubbo/pull/13155#discussion_r1349633177
##########
dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ReflectionServiceDescriptor.java:
##########
@@ -74,6 +76,13 @@ private void initMethods() {
}
methods.forEach((methodName, methodList) -> {
+ //pb method not allow override
+ if(methodList.size() > 1){
+ long pbMethodCount =
methodList.stream().filter(methodDescriptor ->
Arrays.stream(methodDescriptor.getParameterClasses()).anyMatch(pclss ->
isProtobufClass(pclss))).count();
+ if(pbMethodCount > 0L){
+ throw new IllegalStateException("Protobuf method not allow
override,"+"method(" + methodName + ").");
Review Comment:
also print interface name
##########
dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ReflectionServiceDescriptor.java:
##########
@@ -89,6 +98,21 @@ private void initMethods() {
+" stream method signatures. method(" + methodName + ")");
});
}
+
+ public static boolean isProtobufClass(Class<?> clazz) {
+ while (clazz != Object.class && clazz != null) {
+ Class<?>[] interfaces = clazz.getInterfaces();
+ if (interfaces.length > 0) {
+ for (Class<?> clazzInterface : interfaces) {
+ if
(PROTOBUF_MESSAGE_CLASS_NAME.equalsIgnoreCase(clazzInterface.getName())) {
Review Comment:
`equals` is enough?
##########
dubbo-common/src/main/java/org/apache/dubbo/rpc/model/ReflectionServiceDescriptor.java:
##########
@@ -89,6 +98,21 @@ private void initMethods() {
+" stream method signatures. method(" + methodName + ")");
});
}
+
+ public static boolean isProtobufClass(Class<?> clazz) {
+ while (clazz != Object.class && clazz != null) {
+ Class<?>[] interfaces = clazz.getInterfaces();
+ if (interfaces.length > 0) {
+ for (Class<?> clazzInterface : interfaces) {
+ if
(PROTOBUF_MESSAGE_CLASS_NAME.equalsIgnoreCase(clazzInterface.getName())) {
+ return true;
+ }
+ }
+ }
+ clazz = clazz.getSuperclass();
Review Comment:
Is it really in need to check super class?
--
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]