Bug 1690 - Local variables not always displayed when in scope (1GJ8PX4)
Summary: Local variables not always displayed when in scope (1GJ8PX4)
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 2.0   Edit
Hardware: All Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-10 22:17 EDT by Nick Edgar CLA
Modified: 2001-11-01 11:32 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2001-10-10 22:17:41 EDT
Stepping through org.eclipse.swt.layout.GridLayout.calculateGridDimensions(...),
I found that the variables it declared in the first statement as:
	int maxWidth, childWidth, maxHeight, childHeight;
would appear and disappear in the variables view as I stepped through the code

They did not appear until first assigned.
childWidth disappeared when I exited the nested for loop for row.
maxWidth disappeared when I exited the for loop for column.

I would expect them to always be visible after the first statement, or at least after they're first assigned,
until the method returns.

NOTES:

NE (08/29/01 6:04:59 PM)
	Screen shot in Q:\viper\team\Nick\PRs\1GJ8PX4.zip

DW (9/7/01 8:56:26 AM)
	I think this is due to the way the byte codes are generated. The variables 
	are allocated inside the loops, even though they are declared outside the
	loops.

	Waiting for clarification from PM.
Comment 1 DJ Houghton CLA 2001-10-24 06:38:30 EDT
PRODUCT VERSION:
133

Comment 2 Olivier Thomann CLA 2001-11-01 11:21:31 EST
Local variables appear in the debugger only when they are definitely assigned. 
In this example, maxWidth is definitely assigned in the for loop, but it is not 
as soon as it exited the for loop. The reason is that the for loop might not 
have been executed before you reach the if statement. Then the variable is not 
definitely assigned and there is no reason according to the specs to diplay it.
In order to know when a local variable should be displayed or not, you should 
try to use it without initializing it in the source code and if you get an error 
saying that this variable might not have been initialized, then this variable 
should not be displayed at this position in the debugger.
Suggest to close.
Comment 3 Nick Edgar CLA 2001-11-01 11:32:04 EST
Thanks for the clarification.