changeset 54530:00c0906bf4d1

8220625: tools/javac/classreader/8171132/BadConstantValue.java failed with "did not see expected error" Reviewed-by: clanger
author mdoerr
date Mon, 15 Apr 2019 10:16:04 +0200
parents d2c2622995e2
children edf1b4c6b936
files test/langtools/tools/javac/classreader/8171132/BadConstantValue.java
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);