illegal-escape-text
What it does
Section titled “What it does”Reports a string or character literal that writes a backspace, tab, line feed, form feed, carriage return, quote or backslash as an octal or unicode escape (\u0009).
Why it matters
Section titled “Why it matters”These characters have their own escapes (\b, \t, \n, \f, \r, \", \', \\) which every reader knows. A unicode escape for a line feed is even translated before the lexer runs, so \u000a in a string ends the line and does not compile.
To fix, use the special escape.
Example
Section titled “Example”class A { String a = "\u0009"; String b = "\011"; String c = "\t\u0041"; char d = '\u0027'; String e = "\134";}Configuration
Section titled “Configuration”java: lint: rules: illegal-escape-text: warn # off (default), warn, errorEnabled by the presets: java/google.
Suppress one line with sudsy-disable-next-line illegal-escape-text in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| checkstyle | IllegalTokenText |
partial | Only the special-escape message of the Google config. |