changeset 3222:e656b4d10580

6533516: Warning needed for file with future time stamps Reviewed-by: jjg, vromero Contributed-by: paul.govereau@oracle.com
author jjg
date Wed, 26 Feb 2014 18:05:02 -0800
parents 008f76d3209a
children ac4bb3be9217
files src/share/classes/com/sun/tools/javac/file/RegularFileObject.java src/share/classes/com/sun/tools/javac/resources/compiler.properties test/tools/javac/diags/examples.not-yet.txt
diffstat 3 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Wed Feb 26 15:38:55 2014 -0800
+++ b/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Wed Feb 26 18:05:02 2014 -0800
@@ -71,6 +71,8 @@
         }
         this.name = name;
         this.file = f;
+        if (f.lastModified() > System.currentTimeMillis())
+            fileManager.log.warning("file.from.future", f);
     }
 
     @Override
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Feb 26 15:38:55 2014 -0800
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Feb 26 18:05:02 2014 -0800
@@ -1158,6 +1158,10 @@
 compiler.misc.x.print.rounds=\
     Round {0}:\n\tinput files: {1}\n\tannotations: {2}\n\tlast round: {3}
 
+# 0: file name
+compiler.warn.file.from.future=\
+    Modification date is in the future for file {0}
+
 #####
 
 ## The following string will appear before all messages keyed as:
--- a/test/tools/javac/diags/examples.not-yet.txt	Wed Feb 26 15:38:55 2014 -0800
+++ b/test/tools/javac/diags/examples.not-yet.txt	Wed Feb 26 18:05:02 2014 -0800
@@ -110,4 +110,4 @@
 compiler.warn.unknown.enum.constant                     # in bad class file
 compiler.warn.unknown.enum.constant.reason              # in bad class file
 compiler.warn.override.equals.but.not.hashcode          # when a class overrides equals but not hashCode method from Object
-
+compiler.warn.file.from.future                          # warning for future modification times on files