6533516: Warning needed for file with future time stamps
authorjjg
Wed, 26 Feb 2014 18:05:02 -0800
changeset 23128 c91951cf65f0
parent 23127 5aba53c2b9b2
child 23129 6d3b2e246dac
6533516: Warning needed for file with future time stamps Reviewed-by: jjg, vromero Contributed-by: paul.govereau@oracle.com
langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java
langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties
langtools/test/tools/javac/diags/examples.not-yet.txt
--- a/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Wed Feb 26 15:38:55 2014 -0800
+++ b/langtools/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/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Feb 26 15:38:55 2014 -0800
+++ b/langtools/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/langtools/test/tools/javac/diags/examples.not-yet.txt	Wed Feb 26 15:38:55 2014 -0800
+++ b/langtools/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