Reports instantiations of Throwable
or its subclasses, when the created Throwable
is never actually thrown.
These reports indicate mistakes that are hard to catch in tests.
Also, this inspection reports method calls that return instances of Throwable
or its subclasses,
when the result of the method call is not thrown.
Calls to methods annotated with the Error Prone's or AssertJ's @CanIgnoreReturnValue
annotation will not be reported.
Example:
void leftBehind() throws Throwable {
RuntimeException e = new RuntimeException(""throw me"");
// ...
}