First of all, I want to make something clear before I get yelled at: I have no plans to write any code that will ever use this sort of control flow; its obviously terrible. Forget about a use case, this is more a question about whether its possible or not:
I want to know if its possible to know if somewhere up the call stack, a function is being called within a catch block for a particular exception.
Let's say I have a function:
foo() {
try {
something
}
catch (SuperException s) {
bar()
}
So given NO control over the method signature of bar, and given bar is also called by many other functions, can bar behave differently if called in catch block catching a superexception? (and no, being called by foo isn't a sufficient condition, its the super exception that matters)