mirror of
https://github.com/github/codeql.git
synced 2026-03-23 16:06:47 +01:00
As pointed out in 8325's thread, this breaks the corner case of char-literal addition and the convention that getStringValue only applies to String-typed constants.
25 lines
537 B
Java
25 lines
537 B
Java
package constants;
|
|
|
|
class Constants {
|
|
void constants(final int notConstant) {
|
|
final int sfield = Initializers.SFIELD;
|
|
final int ifield = new Initializers().IFIELD;
|
|
|
|
// Not a constant: the type is wrong
|
|
final Object staticObjectField = Initializers.SFIELD_OBJECT;
|
|
|
|
final int x = 3;
|
|
final int y = x;
|
|
final int z = y;
|
|
|
|
int binop = Initializers.SFIELD + 1;
|
|
int binopNonConst = Initializers.SFIELD + notConstant;
|
|
|
|
int paren = (12);
|
|
String string = "a string";
|
|
int ternary = (3 < 5) ? 1 : 2;
|
|
|
|
return;
|
|
}
|
|
}
|