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