Class SignatureDeclareThrowsExceptionRule

  • All Implemented Interfaces:
    AstVisitor<Object,​Object>, JavaParserVisitor, JavaVisitor<Object,​Object>, PropertySource, Rule

    public class SignatureDeclareThrowsExceptionRule
    extends AbstractJavaRulechainRule
    A method/constructor shouldn't explicitly throw java.lang.Exception, since it is unclear which exceptions that can be thrown from the methods. It might be difficult to document and understand such vague interfaces. Use either a class derived from RuntimeException or a checked exception.

    This rule uses PMD's type resolution facilities, and can detect if the class implements or extends TestCase class

    Since:
    1.2
    Version:
    1.0
    Author:
    Trond Andersen
    • Constructor Detail

      • SignatureDeclareThrowsExceptionRule

        public SignatureDeclareThrowsExceptionRule()