Java Reference
In-Depth Information
Figure 9.6 The method call hierarchy isn't truly a hierarchy; rather, it's
a cross-cut of an intricate web of interconnections displayed in a
hierarchical fashion. It's arguably more useful than the Find Usages
operation, because it lets you traverse multiple levels through any
usage of the method instead of tracing just one.
This view, however, also includes a recursive list of all code paths that can be used
to reach the method.
Ta ke , f o r e x a m p l e , t h e requestCurrentRate() method shown in figure 9.6,
which requests the current exchange rate between two currencies from a currency
exchange service. As you can see, it's called from three other methods: within two
different client applications (one a command line, one a Swing GUI interface)
and within a unit test class. At first glance, this information isn't any more helpful
than the Find Usages command; but if you drill down further, you can see where
each of those referenced methods is called.
This view is a great way to analyze how and where a method is being used in
preparation for refactoring or reorganization of your code. The Scope option in
the toolbar lets you limit the scope of the usages searched to the entire project,
the current class, or everything (including libraries).
If you have a very large source tree, don't be surprised if IDEA needs a
few moments to track down all the call paths!
WARNING
9.2 Locating potential problems
w ith the code inspector
In chapters 2 and 3, you learned a lot about IDEA 's ability to spot Java syntax
problems as you type. This feature helps you handle almost all compilation
 
 
 
Search WWH ::




Custom Search