View Javadoc
1   /*
2   RequireThis
3   checkFields = (default)true
4   checkMethods = (default)true
5   validateOnlyOverlapping = false
6   
7   
8   */
9   
10  // someexamples of 1.5 extensions
11  package com.puppycrawl.tools.checkstyle.checks.coding.requirethis;
12  
13  @interface MyAnnotation1 {
14      String name();
15      int version();
16  }
17  
18  @MyAnnotation1(name = "ABC", version = 1)
19  public class InputRequireThis15Extensions
20  {
21  
22  }
23  
24  enum Enum2
25  {
26      A, B, C;
27      Enum2() {}
28      public String toString() {
29          return ""; //some custom implementation
30      }
31  }
32  
33  interface TestRequireThisEnum
34  {
35      enum DAY_OF_WEEK
36      {
37          SUNDAY,
38          MONDAY,
39          TUESDAY,
40          WEDNESDAY,
41          THURSDAY,
42          FRIDAY,
43          SATURDAY
44      }
45  }
46  class NestedClass {
47      protected RuntimeException exception = new RuntimeException() {};
48  
49      public void anonEx2() {
50          RuntimeException exception = new RuntimeException();
51          try {
52              //some code
53              String re = "lol";
54          } catch (Exception e) {
55              throw exception;
56          }
57      }
58  }
59  class Basic {
60      abstract class Awaiter extends Thread {
61          private volatile Throwable result = null;
62          protected void result(Throwable result) { this.result = result; }
63      }
64  
65      private Awaiter awaiter() {
66          return new Awaiter() {
67              public void run() {
68                  try {}
69                  catch (Throwable result) { result(result); }
70              }
71          };
72      }
73  }