== Why is this an issue?

The purpose of checked exceptions is to ensure that errors will be dealt with, either by propagating them or by handling them, but some believe that checked exceptions negatively impact the readability of source code, by spreading this error handling/propagation logic everywhere.


This rule verifies that no method throws a new checked exception.


=== Noncompliant code example

[source,java]
----
public void myMethod1() throws CheckedException {
  ...
  throw new CheckedException(message);   // Noncompliant
  ...
  throw new IllegalArgumentException(message); // Compliant; IllegalArgumentException is unchecked
}   

public void myMethod2() throws CheckedException {  // Compliant; propagation allowed
  myMethod1();
}
----


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Remove this "throw" statement.


'''
== Comments And Links
(visible only on this page)

=== on 29 Jul 2013, 16:06:35 Freddy Mallet wrote:
Is implemented by \http://jira.codehaus.org/browse/SONARJAVA-250

=== on 31 Jul 2013, 13:41:08 Dinesh Bolkensteyn wrote:
Not be used is a bit strong, as you're still allowed to catch java.io.IOException for example.


It's just that it should not be part of the API

=== on 19 Aug 2013, 07:35:18 Dinesh Bolkensteyn wrote:
Removed 'Java' from covered languages, as we finally postponed the implementation.

endif::env-github,rspecator-view[]
