boolean binary expressions of the format false && non_constant and true || non_constant can be evaluated as constant at compile time

This commit is contained in:
Bas Leijdekkers
2011-06-27 23:28:02 +02:00
parent ea6dca5366
commit 3645fce7be
3 changed files with 60 additions and 30 deletions
@@ -9,6 +9,12 @@ public class ClassWithConstants {
public static final byte BYTE_CONST = 4;
public static final char CHAR_CONST = '5';
public static final boolean BOOL_CONST = true;
public static final boolean BOOL_CONST2 = false && foo();
public static final boolean BOOL_CONST3 = true || foo();
static boolean foo() {
return false;
}
public static final float FLOAT_CONST = 1.234f;
public static final double DOUBLE_CONST = 3.456;
public static final java.lang.String STRING_CONST = "a\r\n\"bcd";