View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="RedundantModifier"/>
5     </module>
6   </module>
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.modifier.redundantmodifier;
10  
11  // xdoc section -- start
12  public class Example1 {
13  
14    void test() {
15      // violation below, 'Redundant 'final' modifier'
16      try (final var a = lock()) {
17  
18      } catch (Exception e) {
19  
20      }
21    }
22  
23    // violation below, 'Redundant 'abstract' modifier'
24    abstract interface I {
25      public abstract void m();
26      // 2 violations above:
27      //    'Redundant 'public' modifier'
28      //    'Redundant 'abstract' modifier'
29      public int x = 0; // violation, 'Redundant 'public' modifier'
30    }
31  
32    static enum E { // violation, 'Redundant 'static' modifier'
33          A, B, C
34    }
35  
36    // violation below, 'Redundant 'strictfp' modifier'
37    public strictfp class Test { }
38  
39    AutoCloseable lock() {
40      return null;
41    }
42  
43  }
44  // xdoc section -- end