View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="RedundantModifier">
5         <property name="tokens" value="METHOD_DEF"/>
6       </module>
7     </module>
8   </module>
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.modifier.redundantmodifier;
12  
13  // xdoc section -- start
14  public class Example2 {
15  
16    void test() {
17      try (final var a = lock()) {
18  
19      } catch (Exception e) {
20  
21      }
22    }
23  
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;
30    }
31  
32    static enum E {
33          A, B, C
34    }
35  
36    public strictfp class Test { }
37  
38    AutoCloseable lock() {
39      return null;
40    }
41  }
42  // xdoc section -- end