Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Variable View doesnt behave as I expect
Variable View doesnt behave as I expect [message #1220149] Tue, 10 December 2013 01:30 Go to next message
Eclipse UserFriend
There is something wrong with the variables view or I just expect way too much from it.

When its got a column labeled value - i expect to see the actual value of the variable instead I see its type. Thats not much help, It looks like somebody has just taken a shortcut and put the toString() method of the variable there. So is there a simple way to see the values of variables as I debug ?
Re: Variable View doesnt behave as I expect [message #1220239 is a reply to message #1220149] Tue, 10 December 2013 09:45 Go to previous messageGo to next message
Eclipse UserFriend
For primitive types and well known types such as String, the column will show the value. For other types including classes you define, there are any number of ways that a value could be inferred. The debugger can't know how you want the value displayed so it will use the toString method since this is available on all objects. You can add detail formatters in the Java Debug preferences to override the default toString behavior. The formatter will display the value in the window at the bottom of the Variables view.
Re: Variable View doesnt behave as I expect [message #1220304 is a reply to message #1220239] Tue, 10 December 2013 19:23 Go to previous messageGo to next message
Eclipse UserFriend
Thanks,has anyone got any ready to go detail formatters for well know classes (eg Date) that I can download to save time?

Ive found this link (but the forum wont let me post it) which gives some helpful info but it seems Im still going to have to reinvent some stuff that Im sure a lot of people have needed in the past.

here is one I just wrote for java.util.Calendar

java.text.DateFormat formatter = java.text.DateFormat.getDateTimeInstance(java.text.DateFormat.DEFAULT, java.text.DateFormat.DEFAULT);
String text = formatter.format(getTime());
text.toString();

[Updated on: Tue, 10 December 2013 19:50] by Moderator

Re: Variable View doesnt behave as I expect [message #1220311 is a reply to message #1220304] Tue, 10 December 2013 23:13 Go to previous message
Eclipse UserFriend
On 12/10/2013 6:23 PM, Flurbius VonDoom wrote:
> Thanks,has anyone got any ready to go detail formatters for well know
> classes (eg Date) that I can download to save time?
They generally aren't that complicated once you understand how they
work. Here is a formatter that uses the default date formatter.

java.text.DateFormat.getDateTimeInstance().format(this)
Previous Topic:JAAS Problem
Next Topic:Integrate a barcode generator in my java program
Goto Forum:
  


Current Time: Fri Apr 18 11:52:52 EDT 2025

Powered by FUDForum. Page generated in 0.02919 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top