Files
codeql/java/ql/test/library-tests/constants/constants/Constants.java
Chris Smowton 496cae7742 Revert 8325, Add CharacterLiteral to CompileTimeConstantExpr.getStringValue
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.
2022-03-11 12:45:53 +00:00

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;
}
}