Espen Schulstad
Espen Schulstad

Reputation: 2445

Method scope search in intellij - find all exceptions

In my java project I have a method, and would like to know how to find all usages of a specific Exception-class in the class call hierarchy.

Is it possible to have a method-scope-search (with call hierarchy)?

E.g since this wasn't that easy to understand.

FirstClass.method() call the following methods in two other classes; SecondClass.method() ThirdClass.method()

In both SecondClass and ThirdClass a "new SpecificException()" might be trown.

I'd like to know all places where this specific exception can been thrown, specifically relating to the FirstClass.method().

Upvotes: 3

Views: 1171

Answers (2)

Bas Leijdekkers
Bas Leijdekkers

Reputation: 26532

It is possible, but only in the just released IntelliJ IDEA 16 EAP. Here's how:

  • Invoke Call Hierarchy on FirstClass.method()
  • Browse the hierarchy tree to show all methods you are interested in
  • Invoke Find Usages on the exception constructor
  • Edit the Find Usages Settings to Include overloaded methods and search in the Scope Hierarchy 'Callees of method'

This will show everywhere in the hierarchy the exception is created (new expressions).

Upvotes: 1

Nargas
Nargas

Reputation: 121

You could use ALT + F7 key on the exception-class ?

Upvotes: 0

Related Questions