Back to Error Prone

ReturnAtTheEndOfVoidFunction

docs/bugpattern/ReturnAtTheEndOfVoidFunction.md

2.49.0223 B
Original Source

Detects no-op return statements in void functions when they occur at the end of the method.

Instead of:

java
public void stuff() {
  int x = 5;
  return;
}

do:

java
public void stuff() {
  int x = 5;
}