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