Bug 173992

Summary: Duplicate local variable for exception in different catch blocks
Product: [Eclipse Project] JDT Reporter: Victor Toni <victor.toni>
Component: CoreAssignee: David Audel <david_audel>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, eric_jodet
Version: 3.2.1Keywords: contributed
Target Milestone: 3.3 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

Description Victor Toni CLA 2007-02-13 07:14:07 EST
Build ID:  M20060629-1905

Steps To Reproduce:
1.When editing the third catch block the editor gives a "Duplicate local variable" error for the second "exception":

------------------------------

package eclipse.exceptions;

import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.IOException;

import org.xml.sax.SAXException;

public class ExceptionContentAssist {

        public void doSomething() throws FileNotFoundException, EOFException, SAXException{

        }

public void doSomethingElse() {
        try {
                doSomething();
        }
        catch ( SAXException exception) {

        }               
        catch ( FileNotFoundException exception ) {

        }               
        catch ( 
                // working before the slashes
        ) {

        }               
}

}



More information:
Could be reproduced in Eclipse 3.3M5
Comment 1 Olivier Thomann CLA 2007-02-14 08:40:00 EST
Might be related to recovery support.
Comment 2 Eric Jodet CLA 2007-02-15 02:56:47 EST
Created attachment 59026 [details]
Proposed fix

Proposed fix contains:
- fixed grammar
- a filter on invalid referenced types (in case of recovery)
- corresponding test case

All tests completed with re-generated parser.
Comment 3 David Audel CLA 2007-02-15 11:13:42 EST
The fix of Eric is good. Thanks Eric.

Released for 3.3M6.

Tests added
  ParserTest#test027()
  StatementRecoveryTest#test0044()
Comment 4 Dani Megert CLA 2007-02-15 11:22:51 EST
>The fix of Eric is good.
What was broken with Eric? ;-)
Comment 5 David Audel CLA 2007-02-15 11:40:06 EST
Eric isn't really broken but we need to improve it because currently he isn't fully functional ;-p
Comment 6 Maxime Daniel CLA 2007-03-20 04:32:36 EDT
Verified for 3.3 M6 using build I20070319-1335.