From: acolyer Date: Mon, 26 Apr 2004 15:00:44 +0000 (+0000) Subject: fixes a tiny window of error in incremental compilation. File.lastModified() X-Git-Tag: Root_ajdt_support X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0a624fc22e84c2665f17a18b9c66b9b387487e0b;p=aspectj.git fixes a tiny window of error in incremental compilation. File.lastModified() only reports timestamps to the second (rounding down). We compare against the lastBuildTime. It is therefore possible to miss updates that have occured <1000ms after the last build. --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java index 9c531df4a..6950b307a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java @@ -131,8 +131,9 @@ public class AjState { if (!file.exists()) continue; long modTime = file.lastModified(); - //System.out.println("check: " + file + " mod " + modTime + " build " + lastBuildTime); - if (modTime >= lastBuildTime) { + //System.out.println("check: " + file + " mod " + modTime + " build " + lastBuildTime); + // need to add 1000 since lastModTime is only accurate to a second on some (all?) platforms + if (modTime + 1000 >= lastBuildTime) { ret.add(file); } } @@ -153,7 +154,8 @@ public class AjState { long modTime = file.lastModified(); //System.out.println("check: " + file + " mod " + modTime + " build " + lastBuildTime); - if (modTime >= lastBuildTime) { + // need to add 1000 since lastModTime is only accurate to a second on some (all?) platforms + if (modTime + 1000 >= lastBuildTime) { ret.add(bsfile); } }