I’ll start with a piece of code
class Clazz {
public void doSomething() {
...
check();
}
public void doSomethingElse() {
...
check();
}
... // etc., these methods look basically the same - they all call check() at the end
}
Is it possible to annotate methods like @Checked which would cause to call the check() at the end? And if it is, can you provide some examples?
Yeah – it is possible. You need to instrument your code, typically with aspects (AOP). Check out this example if you want to see what it looks like.