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