An exception in a throws
declaration in Java is superfluous if it is:
RuntimeException
, or one of its descendants void foo() throws MyException, MyException {} // Noncompliant; should be listed once void bar() throws Throwable, Exception {} // Noncompliant; Exception is a subclass of Throwable void baz() throws RuntimeException {} // Noncompliant; RuntimeException can always be thrown
void foo() throws MyException {} void bar() throws Throwable {} void baz() {}