View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="IllegalThrows">
5         <property name="ignoreOverriddenMethods" value="false"/>
6       </module>
7     </module>
8   </module>
9   */
10  package com.puppycrawl.tools.checkstyle.checks.coding.illegalthrows;
11  
12  // xdoc section -- start
13  public class Example4 {
14    // violation below, 'Throwing 'RuntimeException' is not allowed'
15    void f1() throws RuntimeException {}
16    void f2() throws Exception {}
17    void f3() throws Error {}  // violation, 'Throwing 'Error' is not allowed'
18    void f4() throws Throwable {} // violation, 'Throwing 'Throwable' is not allowed'
19    void f5() throws NullPointerException {}
20    @Override // violation below, 'Throwing 'Error' is not allowed'
21    public String toString() throws Error {
22      String str = "";
23      return str;
24    }
25  }
26  // xdoc section -- end