8220625: tools/javac/classreader/8171132/BadConstantValue.java failed with "did not see expected error"
Reviewed-by: clanger
--- a/test/langtools/tools/javac/classreader/8171132/BadConstantValue.java Sun Apr 14 21:40:07 2019 +0000
+++ b/test/langtools/tools/javac/classreader/8171132/BadConstantValue.java Mon Apr 15 10:16:04 2019 +0200
@@ -134,6 +134,8 @@
"class Lib { static final int A = %s; static final %s B = %s; }",
value, type, (type.equals("boolean") ? "false" : "0")));
compile("-d", classesdir.getPath(), lib.getPath());
+ // Lib.class may possibly not get a newer timestamp. Make sure .java file won't get used.
+ lib.delete();
File libClass = new File(classesdir, "Lib.class");
// Rewrite the class to only have field B of type "type" and with "value" (potentially
// out of range).
@@ -147,6 +149,8 @@
"class Lib { static final String A = \"hello\"; static final %s CONST = %s; }",
type, type.equals("boolean") ? "false" : "0"));
compile("-d", classesdir.getPath(), lib.getPath());
+ // Lib.class may possibly not get a newer timestamp. Make sure .java file won't get used.
+ lib.delete();
File libClass = new File(classesdir, "Lib.class");
swapConstantValues(libClass);