Bug 143001 - Statement recovery doesn't recover broken try statement
Summary: Statement recovery doesn't recover broken try statement
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M3   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-22 11:20 EDT by David Audel CLA
Modified: 2006-10-30 14:57 EST (History)
0 users

See Also:


Attachments
Proposed fix (1.24 KB, patch)
2006-05-22 11:34 EDT, David Audel CLA
no flags Details | Diff
Regression test (13.55 KB, patch)
2006-05-22 11:34 EDT, David Audel CLA
no flags Details | Diff
Updated fix (16.97 KB, patch)
2006-09-25 04:39 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2006-05-22 11:20:52 EDT
From bug 142793

public class X {
  void bar(Collection<String> c) {
    for(String s: c) {
      try {
        bar();
      }
    }
  }
}

This test case has a syntax error:
"Syntax error, insert "Finally" to complete BlockStatements"

In this case the statement recovery fail because it is not able to rebuild a fake "Finally".
Comment 1 David Audel CLA 2006-05-22 11:34:26 EDT
Created attachment 42162 [details]
Proposed fix

This fix must be applied and the files parser22.rsc and parser23.rsc must regenerate.
Comment 2 David Audel CLA 2006-05-22 11:34:57 EDT
Created attachment 42163 [details]
Regression test
Comment 3 David Audel CLA 2006-05-22 11:37:08 EDT
With this fix, the recovered ast look like

public class X {
  void bar(Collection<String> c) {
    for(String s: c) {
      try {
        bar();
      } finally {
      }
    }
  }
}

A fake 'finally {}' is added.
Comment 4 David Audel CLA 2006-09-25 04:39:51 EDT
Created attachment 50790 [details]
Updated fix
Comment 5 David Audel CLA 2006-09-25 04:45:13 EDT
Released for 3.3 M3.

Test added
  StatementRecoveryTest_1_5#test0001()
Test updated
  ASTConverter15Test#test0220()
Comment 6 Olivier Thomann CLA 2006-10-30 14:57:05 EST
Verified for 3.3 M3 using warm-up build I20061030-0800