Bug 97820

Summary: [1.5][dom] Syntax error in for each statement makes all method statements disappearing
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: david_audel
Version: 3.1   
Target Milestone: 3.2 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Frederic Fusier CLA 2005-06-01 08:38:34 EDT
Using 3.1 RC1

public class X {
	public static void main(String[] args) {
		int i= 0;
		for (String s  args) {
			System.out.println("ZORK");
		}
		int j = 0;
		int k=i+j;
	}
}

Looking at ASTView on main method declaration which misses ':' in for statement,
I can see method is malformed (OK) and does not content any statement...

As recovery rightly suggests to insert ':' after s formal parameter, I would
expect AST convertion able to display method statements even with this syntax error.
Comment 1 Olivier Thomann CLA 2005-06-01 08:46:08 EDT
This is a known issue. When a syntax error arises in a method, the whole method
is considered as a problem method and has no statement.
Talk to David to find out if the recovery at the statement level is supposed to
be in.
Comment 2 David Audel CLA 2005-06-01 09:01:04 EDT
Currently there is no statement recovery

*** This bug has been marked as a duplicate of 42253 ***
Comment 3 Frederic Fusier CLA 2006-02-15 11:38:41 EST
Verified for 3.2 M5 using build I20060215-0010.