ronenhamias / scalecube-services

v2.0 - ScaleCube Services provides a low latency Reactive Microservices library for serverless service registry and discovery based on gossip protocol and without single point-of-failure or bottlenecks.
http://scalecube.io/
Apache License 2.0
26 stars 7 forks source link

Ban method definitions with plain `void` as return type #220

Open artem-v opened 6 years ago

artem-v commented 6 years ago
if (returnType.isAssignableFrom(Void.TYPE)) {
  throw new IllegalMethodDefinitionWeDontSupportThisException();
}

You can define:

  Mono<Void> funcVoidReactive();

You should not be allowed to define:

void funcNonReactive();

Motivation: it's hard to combine plain void functions, let's define convention that our service definitions has to be pure functions, i.e. must return somerhinhg , even if it's Mono. Why do that? For caring about api clients, about their ability to combine.

artem-v commented 6 years ago

looping @ronenhamias