From e3f938229591f3fd40abf09c9999132bcfed30c4 Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Sun, 27 Feb 2000 19:13:56 +0000 Subject: [PATCH] Issue a warning if a java source is found to be modified in the future relative to the clock on the current machine. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267620 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/Javac.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index 9e8742fed..2cb747fdc 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -252,12 +252,21 @@ public class Javac extends MatchingTask { */ private void scanDir(File srcDir, File destDir, String files[]) { + + long now = (new Date()).getTime(); + for (int i = 0; i < files.length; i++) { File srcFile = new File(srcDir, files[i]); if (files[i].endsWith(".java")) { File classFile = new File(destDir, files[i].substring(0, files[i].indexOf(".java")) + ".class"); + + if (srcFile.lastModified() > now) { + project.log("Warning: file modified in the future: " + + files[i], project.MSG_WARN); + } + if (srcFile.lastModified() > classFile.lastModified()) { compileList.addElement(srcFile.getAbsolutePath()); }