I have a runtime exception that I have created in my project, and I want to make sure that it is caught in one of my classes, so that the whole program doesn't explode when it occurs (i.e. if anyone deletes the try/catch statement I want to know by having something in the build or static analysis tools fail). Unfortunately, as java doesn't enforce me to have the try/catch statement for this unchecked exception, there is no way to enforce it on compile time. (I cannot change my exception to be a checked exception).
I am wondering if there is any way to enforce a try/catch statement in a specific class, probably with the use of the checkstyle/pmd/findbugs custom rules. (check that a specific method in a specific class has a try catch statement for my runtime exception).
Thanks.