Bug 173992 - Duplicate local variable for exception in different catch blocks
Summary: Duplicate local variable for exception in different catch blocks
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M6   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-02-13 07:14 EST by Victor Toni CLA
Modified: 2007-06-06 17:54 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix (3.57 KB, patch)
2007-02-15 02:56 EST, Eric Jodet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.