An exception in a throws declaration in Java is superfluous if it is:

Noncompliant Code Example

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

Compliant Solution

void foo() throws MyException {}
void bar() throws Throwable {}
void baz() {}

Exceptions

The rule will not raise any issue for exceptions that cannot be thrown from the method body:

class A extends B {
  @Override
  void doSomething() throws IOException {
    compute(a);
  }

  public void foo() throws IOException {}

  protected void bar() throws IOException {
    throw new UnsupportedOperationException("This method should be implemented in subclasses");
  }

  Object foobar(String s) throws IOException {
    return null;
  }

  /**
   * @throws IOException Overriding classes may throw this exception if they print values into a file
   */
  protected void print() throws IOException { // no issue, method is overridable and the exception has proper javadoc
    System.out.println("foo");
  }
}