Bug 111618 - [1.5][dom] Foreach statement shows extraneous semi column into debug variables view
Summary: [1.5][dom] Foreach statement shows extraneous semi column into debug variable...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: 3.2 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-05 10:50 EDT by Maxime Daniel CLA
Modified: 2005-10-31 06:18 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Daniel CLA 2005-10-05 10:50:00 EDT
Build id: I20050923-1000

When debugging into code that parses Java source into a model, the following
statement:
for (Object o : i) {
  o.toString();
}
appears as follows when selecting the matching ForeachStatement instance into
the variables view of the debugger:
for (Object o; : i) {
  o.toString();
}
(note the extraneous ; after o).
This must be related to printStatement, which calls Statement.print, hence
gets the terminator whereas it should not.
Comment 1 Olivier Thomann CLA 2005-10-05 13:15:42 EDT
yes, this is related to the fact that Object o is considered as a local
declaration and therefore it is printed as a statement. We would need to change
the printStatement(...) implementation of the ForeachStatement not to use the
print method for the local declaration.
But this is for debugging purpose anyway, so is it really worth it?
Comment 2 Olivier Thomann CLA 2005-10-06 19:37:42 EDT
I'll fix it. We simply cannot use the print method for the local variable
declaration in the foreach.
Comment 3 Olivier Thomann CLA 2005-10-06 21:03:33 EDT
Fixed and released in HEAD.
Regression test added in
org.eclipse.jdt.core.tests.compiler.parser.DietRecoveryTest.test113.
Comment 4 David Audel CLA 2005-10-31 06:18:03 EST
Verified for 3.2 M3 using build I20051031-0010