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