1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="RedundantModifier"> 5 <property name="jdkVersion" value="11"/> 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 Example3 { 15 16 void test() { 17 // violation below, 'Redundant 'final' modifier' 18 try (final var a = lock()) { 19 20 } catch (Exception e) { 21 22 } 23 } 24 25 // violation below, 'Redundant 'abstract' modifier' 26 abstract interface I { 27 public abstract void m(); 28 // 2 violations above: 29 // 'Redundant 'public' modifier' 30 // 'Redundant 'abstract' modifier' 31 public int x = 0; // violation, 'Redundant 'public' modifier' 32 } 33 34 static enum E { // violation, 'Redundant 'static' modifier' 35 A, B, C 36 } 37 38 // ok below, 'strictfp' is not redundant before JDK 17 39 public strictfp class Test { } 40 41 AutoCloseable lock() { 42 return null; 43 } 44 45 } 46 // xdoc section -- end