View Javadoc
1   /*
2   RedundantModifier
3   tokens = (default)METHOD_DEF, VARIABLE_DEF, ANNOTATION_FIELD_DEF, INTERFACE_DEF, \
4            CTOR_DEF, CLASS_DEF, ENUM_DEF, RESOURCE
5   jdkVersion = 11
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.modifier.redundantmodifier;
10  
11  /**
12   * Test case for Modifier checks:
13   * - order of modifiers
14   * - use of 'public' in interface definition
15   * @author lkuehne
16   */
17  strictfp final class InputRedundantModifierItTwo {
18  }
19  /** Holder for redundant modifiers of annotation fields/variables */
20  @interface Annotation
21  {
22      public String s1 = ""; // violation
23      final String s2 = ""; // violation
24      static String s3 = ""; // violation
25      String s4 = "";
26      public String blah(); // violation
27      abstract String blah2(); // violation
28  }
29  
30  class SafeVarargsUsage {
31      @Deprecated
32      @SafeVarargs
33      private final void foo(int... k) {}
34  
35      @Deprecated
36      @SafeVarargs
37      @SuppressWarnings("")
38      private final void foo1(Object... obj) {}
39  }
40  
41  enum TestEnum {
42      ;
43  
44      public void method() {
45      }
46  }
47  /** holder for interface specific modifier check. */
48  interface InputDefaultPublicModifier
49  {
50      /** correct order */
51      default strictfp void a()
52      {
53      }
54  
55      /** wrong order */
56      strictfp default void b()
57      {
58      }
59  }