1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="MultipleStringLiterals"/> 5 </module> 6 </module> 7 */ 8 9 package com.puppycrawl.tools.checkstyle.checks.coding.multiplestringliterals; 10 11 // xdoc section -- start 12 public class Example1 { 13 String a = "StringContents"; // violation, "StringContents" occurs twice 14 String a1 = "unchecked"; 15 @SuppressWarnings("unchecked") // OK, duplicate strings are ignored in annotations 16 public void myTest() { 17 String a2 = "StringContents"; 18 String a3 = "DuoString" + "DuoString"; // violation, "DuoString" occurs twice 19 String a4 = "SingleString"; 20 String a5 = ", " + ", " + ", "; // violation, ", " occurs three times 21 } 22 } 23 // xdoc section -- end