/* * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
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!");
}
}
}
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
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 ist noch experimentell.