2

Is there an IDE, plugin, or tool where I can specify a Java method and an exception type that it throws, and have the tool tell me where that throw is declared caught?

Ideally, such a tool would make a reasonable attempt to distinguish whether the catch rethrows, and also to find externally accessible methods that call (methods that call methods that call...) this one and do not catch. Ideally, this would filter for various kinds of external accessibility: all public methods, or only "main" methods, or public methods of classes that have a particular superclass (or any superclass from a list), or public methods that override a particular method (or any method from a list).

I know I'm not the first to think of such a thing. It wasn't hard to find some relevant research conference papers from 2007, 2010, and 2015.

1

I found that Eclipse IDE has a command Open Call Hierarchy. For methods near the edge of the call graph, that provides a reasonable way to explore exception catches, as follows.

Use Open Call Hierarchy to explore interactively which methods call the particular method, and which call those, and so on. Click any of the methods to open the method body in an editor. Look whether that method declares throwing the exception type that is of interest (or one of its interfaces or superclasses).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.