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