Want to enforce a restriction of using Instant.now() or new Date() in any Java Method. Below is the sample class
class Demo {
void methodOne() {
Date date = new Date();
// ...
}
void methodTwo() {
Instant instant = Instant.now();
// ...
}
}
The following simple
ArchRuleunconditionally forbids calling these methods:For your
Democlass, this gives: