Using Acceptable Legal Java Expressions in the Debugger

Java expressions are used in the Watches window, Inspector windows, Breakpoint Conditions, and Breakpoint Log Expressions. The following are examples of acceptable legal Java expressions you can use in the debugger:

Simple variable name:
rect
Field access:
rect.width
Array element:
myArray[3]
Array length:
myArray.length
Comparison operation:
rect.height == 100
myArray.length > 7
Arithmetic operation:
rect.width * rect.height
x + y + z
Logical operation:
frame1.enabled && frame1.visible
textField1.hasFocus || textField2.hasFocus
Instance of operator:
<my_value> instanceof java.lang.String
Shift operator:
x << 2
y >> 1
Binary operator:
keyEvent.modifiers & java.awt.event.InputEvent.CTRL_MASK
Question-colon operation:
y>5 ? y*7 : y*4
Static field name:
java.awt.Color.pink
Note: OJC warning #320, Field or method is static and should be accessed with the class name instead," displays in the Log window, when you access a static field method using an object instance instead of the class name to flag every static access with object instances as potentially dangerous. The following example implies that thread t will sleep for xxx ms. However, the correct meaning is that the method sleep() is static; the entire application sleeps in this case.
Thread t = ...
...
t.sleep (xxx);
 
Fully-qualified class name:
java.awt.Color

Related topics

About the Debugger Windows
Making a Breakpoint Conditional
Controlling Breakpoint Behavior
Using Acceptable Legal PL/SQL Expressions in JDeveloper

 

Copyright © 1997, 2004, Oracle. All rights reserved.