Skip to content

Commit

Permalink
Merge branch 'apache-3.2' into 3.2.8-release
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbumenJ committed Nov 1, 2023
2 parents f03c28e + aa631cd commit 6b4e13a
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 350 deletions.
5 changes: 0 additions & 5 deletions dubbo-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,5 @@
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.dubbo.rpc.model;

import org.apache.dubbo.common.utils.CollectionUtils;
import org.apache.dubbo.common.utils.ProtobufUtils;
import org.apache.dubbo.metadata.definition.ServiceDefinitionBuilder;
import org.apache.dubbo.metadata.definition.model.FullServiceDefinition;

Expand Down Expand Up @@ -75,26 +74,19 @@ 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(ProtobufUtils::isProtobufClass)).count();
if (pbMethodCount > 0L) {
throw new IllegalStateException("Protobuf method not allow override," + "method(" + interfaceName + "." + methodName + ").");
}
}
Map<String, MethodDescriptor> descMap = descToMethods.computeIfAbsent(methodName, k -> new HashMap<>());
// not support BI_STREAM and SERVER_STREAM at the same time, for example,
// void foo(Request, StreamObserver<Response>) ---> SERVER_STREAM
// StreamObserver<Response> foo(StreamObserver<Request>) ---> BI_STREAM
long streamMethodCount = methodList.stream()
long streamMethodCount = methodList.stream()
.peek(methodModel -> descMap.put(methodModel.getParamDesc(), methodModel))
.map(MethodDescriptor::getRpcType)
.filter(rpcType -> rpcType == MethodDescriptor.RpcType.SERVER_STREAM
|| rpcType == MethodDescriptor.RpcType.BI_STREAM)
.count();
if (streamMethodCount > 1L)
throw new IllegalStateException("Stream method could not be overloaded.There are " + streamMethodCount
+ " stream method signatures. method(" + methodName + ")");
+" stream method signatures. method(" + methodName + ")");
});
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
import org.apache.dubbo.rpc.support.DemoService;

import org.apache.dubbo.rpc.support.DemoService1;
import org.apache.dubbo.rpc.support.DemoService2;
import org.apache.dubbo.rpc.support.DemoService3;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
Expand Down Expand Up @@ -110,17 +107,4 @@ void testHashCode() {
DemoService.class);
Assertions.assertEquals(service2.hashCode(), service3.hashCode());
}

@Test
void testPbMethodOverride() {
new ReflectionServiceDescriptor(DemoService.class);
new ReflectionServiceDescriptor(DemoService2.class);
String EXPECT_RESPONSE_MSG = "Protobuf method not allow override,method(org.apache.dubbo.rpc.support.DemoService3.sayHello).";
try {
new ReflectionServiceDescriptor(DemoService3.class);
} catch (IllegalStateException e) {
Assertions.assertEquals(EXPECT_RESPONSE_MSG, e.getMessage());
}

}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6b4e13a

Please sign in to comment.