View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="AvoidEscapedUnicodeCharacters">
5         <property name="allowNonPrintableEscapes" 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 Example5 {
15    // OK, a normal String below.
16    String unitAbbrev = "μs";
17    // violation below, printable escape character. 'should be avoided.'
18    String unitAbbrev1 = "\u03bcs";
19    // violation below, printable escape character. 'should be avoided.'
20    String unitAbbrev2 = "\u03bc\u03bc\u03bc";
21    // violation below
22    String unitAbbrev3 = "\u03bcs"; // it is μs
23    // violation below
24    String unitAbbrev4 = "\u03bc\u03bcs";
25    public static int content() {
26      char content = 'r';
27      // OK, non-printable escape character below
28      return '\ufeff' + content;
29    }
30  }
31  // xdoc section -- end