Java Reference
In-Depth Information
Figure 6.11
The expression evaluator lets you go
beyond checking the current value of
fields and variables; you can execute
and evaluate the results of any valid
Java statement in the context of the
current stack frame.
from the right-click menu or with the Alt+F8 shortcut. When launched this way,
the selected expression is added to the expression field of the dialog automatically.
The Expression Evaluator window can accept any valid Java expression, as
long as it can be properly evaluated in the context of the current stack frame. You
can make method calls and perform arithmetic operations, boolean condition
checks, and direct field references. The results of the expression are displayed in
the Result area of the dialog, which behaves like the inspection window we looked
at earlier. If the expression evaluates to an object, you can further inspect its
members just as you can in the inspection window.
The expression evaluator remembers your expressions in the drop-down list
until you exit IDEA . There is only one Expression Evaluator window, however,
making it suited to quick, one-off evaluations. If you need to monitor the value of
multiple expressions, or you want to keep an eye on the value of a particular
expression throughout the debugging session, you should set up a watch , as
described in the next section.
IDEA also has the facilities to debug arbitrary expressions. It's not in the criti-
cal path of development and is squarely in the realm of advanced features. You
can consult IDEA 's documentation for more information.
6.4.3
Working with watches
The Wa t c he s tab of the Debug window lets you evaluate any number of variables
or expressions in the context of the current stack frame. The values of the
expressions are updated with each step through the application but are only visi-
ble when the application is suspended. Unlike the Expression Evaluator win-
dow, you can view the value of multiple expressions simultaneously, and these
expressions are persisted as part of the project. The number of configured
watches is displayed in Wa tc h e s tab.
 
 
 
 
 
Search WWH ::




Custom Search