]> source.dussan.org Git - aspectj.git/commitdiff
fixes a tiny window of error in incremental compilation. File.lastModified() Root_ajdt_support
authoracolyer <acolyer>
Mon, 26 Apr 2004 15:00:44 +0000 (15:00 +0000)
committeracolyer <acolyer>
Mon, 26 Apr 2004 15:00:44 +0000 (15:00 +0000)
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.

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java

index 9c531df4a8fce9ce059e312ac8f00ad9a67888e6..6950b307ab214d2a1f52bef248ec4d8a6f1837b8 100644 (file)
@@ -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);
                        } 
                }