-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expand file tree
/
Copy pathCharLiterals.java
More file actions
45 lines (40 loc) · 871 Bytes
/
Copy pathCharLiterals.java
File metadata and controls
45 lines (40 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package charLiterals;
public class CharLiterals {
char[] chars = {
'a',
'\u0061', // 'a'
'\u0000',
'\uFFFF',
'\ufFfF',
'\0',
'\n',
'"',
'\\',
'\'',
'\123', // octal escape sequence for 'S'
// CodeQL uses U+FFFD for unpaired surrogates, see https://github.com/github/codeql/issues/6611
'\uD800', // high surrogate
'\uDC00', // low surrogate
// Using Unicode escapes (which are handled during pre-processing)
'\u005C\u005C', // escaped backslash
'\u005C\u0027', // escaped single quote
\u0027a\u0027, // 'a'
};
// + and - are not part of the literal
int[] charsWithSign = {
+'a',
-'a',
};
// The operation expression (e.g. `+`) is not a literal
int[] numericOperations = {
'a' + 'b',
};
Object[] nonCharLiterals = {
"a",
"",
"\uD800\uDC00", // surrogate pair
0,
Character.MIN_VALUE,
};
char nonLiteral;
}