View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="AvoidEscapedUnicodeCharacters">
5         <property name="allowEscapesForControlCharacters" value="true"/>
6       </module>
7     </module>
8   </module>
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.avoidescapedunicodecharacters;
12  
13  // xdoc section -- start
14  public class Example2 {
15    // OK, a normal String below
16    String unitAbbrev = "μs";
17    // violation below, μs is a printable character. 'should be avoided.'
18    String unitAbbrev1 = "\u03bcs";
19    // violation below
20    String unitAbbrev2 = "\u03bc\u03bc\u03bc";
21    // violation below
22    String unitAbbrev3 = "\u03bcs";
23    // violation below
24    String unitAbbrev4 = "\u03bc\u03bcs";
25    public static int content() {
26      char content = 'r';
27      // OK, non-printable control character.
28      return '\ufeff' + content;
29    }
30  }
31  // xdoc section -- end