The variable view of Eclipse Java Debug mode allows to inspect the values of variables. If the type of a variable has several sub-types, how to find out the actual type of the value?
Eclipse Standard/SDK
Version: Luna Service Release 1 (4.4.1) Build id: 20140925-1800
Use expressions view. If for example your variable name is x
add x.getClass()
to expressions view and see the type.
use ctrl+shift+I
for inspect expressions/variables in debug mode of eclipse
let say i have below code
Example:
List<String> strLst = commonService.getUserdetail();
and i want to know value of strLst than
select commonService.getUserdetail()
and than press ctrl+shift+I it will give you value that comes from commonService.getUserdetail()
method
go HERE to know more about debuging in eclipse
This should be easier with Eclipse 4.17 (2020-09 release) :
Actual type in Variables view
The option
Show Type Names
in the Variables and Expressions views now displays the value's actual type instead of its declared type.
This simplifies debugging especially when variable details (toString()
) is shown As the label for all variables .To enable
Show Type Names
in the Variables view , column mode must be disabled (View Menu > Layout > Show Columns
).Example:
Object s = "some string"; Collection<?> c = Arrays.asList(s, 1); // breakpoint
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.