Path moduleInfo = m1.resolve("module-info.java"); if (moduleInfoTimeStamp.compareTo(Files.getLastModifiedTime(moduleInfo)) < 0) { thrownew AssertionError("Classfiles too old!");
}
Path testTest = m1.resolve("test/Test.java"); if (testTestTimeStamp.compareTo(Files.getLastModifiedTime(testTest)) < 0) { thrownew AssertionError("Classfiles too old!");
}
Thread.sleep(2000); //timestamps
new JavacTask(tb)
.options("-m", "m1x", "--module-source-path", src.toString(), "-d", build.toString())
.run(Task.Expect.SUCCESS)
.writeAll();
if (!moduleInfoTimeStamp.equals(Files.getLastModifiedTime(moduleInfoClass))) { thrownew AssertionError("Classfile update!");
}
if (!testTestTimeStamp.equals(Files.getLastModifiedTime(testTestClass))) { thrownew AssertionError("Classfile update!");
}
// Date back the source file by one second compared to the current time. // Cases have been observed where the resulting class file had an earlier // timestamp than the java source.
Files.setLastModifiedTime(testTest, FileTime.fromMillis(System.currentTimeMillis() - 1000));
new JavacTask(tb)
.options("-m", "m1x", "--module-source-path", src.toString(), "-d", build.toString())
.run(Task.Expect.SUCCESS)
.writeAll();
if (!moduleInfoTimeStamp.equals(Files.getLastModifiedTime(moduleInfoClass))) { thrownew AssertionError("Classfile update!");
}
if (Files.getLastModifiedTime(testTestClass).compareTo(Files.getLastModifiedTime(testTest)) < 0) { thrownew AssertionError("Classfiles too old!");
}
}
if (C1TimeStamp.compareTo(Files.getLastModifiedTime(C1Source)) < 0) { thrownew AssertionError("Classfiles too old!");
}
if (C2TimeStamp.compareTo(Files.getLastModifiedTime(C2Source)) < 0) { thrownew AssertionError("Classfiles too old!");
}
Thread.sleep(2000); //timestamps
new JavacTask(tb)
.options("-m", "m1x,m2x", "--module-source-path", src.toString(), "-d", build.toString())
.run(Task.Expect.SUCCESS)
.writeAll();
if (!m1ModuleInfoTimeStamp.equals(Files.getLastModifiedTime(m1ModuleInfoClass))) { thrownew AssertionError("Classfile update!");
}
if (!m2ModuleInfoTimeStamp.equals(Files.getLastModifiedTime(m2ModuleInfoClass))) { thrownew AssertionError("Classfile update!");
}
if (!C1TimeStamp.equals(Files.getLastModifiedTime(classC1))) { thrownew AssertionError("Classfile update!");
}
if (!C2TimeStamp.equals(Files.getLastModifiedTime(classC2))) { thrownew AssertionError("Classfile update!");
}
// Date back the source file by one second compared to the current time. // Cases have been observed where the resulting class file had an earlier // timestamp than the java source.
Files.setLastModifiedTime(C1Source, FileTime.fromMillis(System.currentTimeMillis() - 1000));
Files.setLastModifiedTime(C2Source, FileTime.fromMillis(System.currentTimeMillis() - 1000));
new JavacTask(tb)
.options("-m", "m1x,m2x", "--module-source-path", src.toString(), "-d", build.toString())
.run(Task.Expect.SUCCESS)
.writeAll();
if (!m1ModuleInfoTimeStamp.equals(Files.getLastModifiedTime(m1ModuleInfoClass))) { thrownew AssertionError("Classfile update!");
}
if (!m2ModuleInfoTimeStamp.equals(Files.getLastModifiedTime(m2ModuleInfoClass))) { thrownew AssertionError("Classfile update!");
}
if (Files.getLastModifiedTime(classC1).compareTo(Files.getLastModifiedTime(C1Source)) < 0) { thrownew AssertionError("Classfiles too old!");
}
if (Files.getLastModifiedTime(classC2).compareTo(Files.getLastModifiedTime(C2Source)) < 0) { thrownew AssertionError("Classfiles too old!");
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.