View Javadoc
1   /*
2   SuppressWarnings
3   format = (default)^\\s*+$
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  public class InputSuppressWarningsHolder {
14      static final String UN_U = "UN_U";
15  
16      @SuppressWarnings(UN_U)
17      int a;
18      @SuppressWarnings(InputSuppressWarningsHolder.UN_U)
19      int b;
20      @SuppressWarnings(
21  com.puppycrawl.tools.checkstyle.checks.annotation.suppresswarnings.InputSuppressWarningsHolder.UN_U)
22      int c;
23      @SuppressWarnings(value = UN_U)
24      int d;
25      @SuppressWarnings(value = InputSuppressWarningsHolder.UN_U)
26      int e;
27      @SuppressWarnings(value =
28  com.puppycrawl.tools.checkstyle.checks.annotation.suppresswarnings.InputSuppressWarningsHolder.UN_U)
29      int f;
30      // violation below, 'The warning '' cannot be suppressed at this location'
31      @SuppressWarnings((1 != 1) ? "" : "UN_U")
32      int g;
33      @SuppressWarnings("un" + "used")
34      int h;
35      @SuppressWarnings((String) "UN_U")
36      int i;
37      // violation below, 'The warning '' cannot be suppressed at this location'
38      @SuppressWarnings({})
39      int j;
40      @SuppressWarnings({UN_U})
41      int k;
42  }
43  
44  class CustomSuppressWarnings {
45      // violation below, 'The warning '' cannot be suppressed at this location'
46      @SuppressWarnings
47      private @interface SuppressWarnings {
48      }
49  }