View Javadoc
1   /*
2   AvoidEscapedUnicodeCharacters
3   allowEscapesForControlCharacters = (default)false
4   allowByTailComment = (default)false
5   allowIfAllCharactersEscaped = (default)false
6   allowNonPrintableEscapes = true
7   
8   
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.avoidescapedunicodecharacters;
12  
13  import java.util.concurrent.TimeUnit;
14  
15  public class InputAvoidEscapedUnicodeCharacters4Two {
16  
17          private String unitAbbrev5 = "\u03bcs";         // violation
18          private String unitAbbrev6 = "\u03bcs";        // violation
19          private String unitAbbrev7 = "\u03bcs";        /* comment separated by tab */ // violation
20          private String unitAbbrev8 = "\u03bcs"; /* comment // violation
21                                                     has 2 lines */
22          void foo() {
23                  for (char c = '\u0000'; c < '\uffff'; c++) {
24                          if (c == '\u001b' ||     // violation
25                                          c == '\u2014')   // violation
26                                  continue;
27                  }
28          }
29          private String unitAbbrev9 = "\u03bcs"; /* comment */ int i; // violation
30  
31          private String notAUnicodeEscaped1 = "\\u1234";
32  
33          private String notAUnicodeEscaped2 = "\\\\u1234";
34  
35          private String onlyEscaped = "\\\u1234"; // violation
36  
37          private String sumilarToEscapedByB = "b\u1234"; // violation
38          private String sumilarToEscapedCommentedByB = "b\u1234"; // violation
39          private String sumilarToEscapedByF = "f\u1234"; // violation
40          private String sumilarToEscapedCommentedByF = "f\u1234"; // violation
41          private String sumilarToEscapedByR = "r\u1234"; // violation
42          private String sumilarToEscapedCommentedByR = "r\u1234"; // violation
43          private String sumilarToEscapedByN = "n\u1234"; // violation
44          private String sumilarToEscapedCommentedByN = "n\u1234"; // violation
45          private String sumilarToEscapedByT = "t\u1234"; // violation
46          private String sumilarToEscapedCommentedByT = "t\u1234"; // violation
47          private String validEscapeWithManyUs = "t\uuuuuuuuu1234"; // violation
48          private String validEscapeWithManyUsCommented = "t\uuuuuuuuu1234"; // violation
49  }