View Javadoc
1   /*
2   SuppressWarnings
3   format = .*un.*
4   tokens = (default)CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF, \
5            ENUM_CONSTANT_DEF, PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF, CTOR_DEF, \
6            COMPACT_CTOR_DEF, RECORD_DEF
7   
8   
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.annotation.suppresswarnings;
12  
13  import java.lang.annotation.Documented;
14  
15  @SuppressWarnings("unchecked") // violation
16  public class InputSuppressWarningsSingle5
17  {
18      @SuppressWarnings("   ")
19      class Empty {
20  
21          @SuppressWarnings("")
22          public Empty() {
23  
24          }
25      }
26  
27      @SuppressWarnings("unused") // violation
28      enum Duh {
29  
30          @SuppressWarnings("unforgiven") // violation
31          D;
32  
33          public static void foo() {
34  
35              @SuppressWarnings("unused") // violation
36              Object o = new InputSuppressWarningsSingle5() {
37  
38                  @Override
39                  @SuppressWarnings("unchecked") // violation
40                  public String toString() {
41                      return "";
42                  }
43              };
44          }
45      }
46  
47      @SuppressWarnings("abcun") // violation
48      @Documented
49      @interface Sweet {
50          int cool();
51      }
52  
53      @Documented
54      @SuppressWarnings("abcun") // violation
55      @interface MoreSweetness {
56  
57          @SuppressWarnings("unused") // violation
58          int cool();
59      }
60  
61      public class Junk {
62  
63          @SuppressWarnings("")
64          int a = 1;
65  
66          @SuppressWarnings("unchecked") // violation
67          @Deprecated
68          int b = 1;
69          void doFoo(String s, @SuppressWarnings("unchecked")String y) { // violation
70  
71          }
72      }
73  
74      @SuppressWarnings((false) ? "unchecked" : "") // violation
75      class Cond {
76  
77          @SuppressWarnings((false) ? "" : "unchecked") // violation
78          public Cond() {
79  
80          }
81  
82          @SuppressWarnings((false) ? (true) ? "   " : "unused" : "unchecked") // 2 violations
83          public void aCond1() {
84  
85          }
86  
87          @SuppressWarnings((false) ? "unchecked" : (true) ? "   " : "unused") // 2 violations
88          public void aCond2() {
89  
90          }
91  
92          @java.lang.SuppressWarnings((false) ? "unchecked" : // violation
93                  ("" == "") ? (false) ? (true) ? "" : "foo" : "    " : "unused") // violation
94          public void seriously() {
95  
96          }
97      }
98  }