Bug 174002 - [assist] Exceptions which are already covered by the another exception are proposed
Summary: [assist] Exceptions which are already covered by the another exception are pr...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M6   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-13 09:33 EST by David Audel CLA
Modified: 2007-03-20 10:13 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix (5.61 KB, patch)
2007-02-15 10:10 EST, 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 2007-02-13 09:33:00 EST
From Victor Toni in bug 157584 comment 9

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

        }               
        catch ( IOException exception ) {

        }               
        catch ( 
                // content assist here

        ) {

        }               
}

I get these suggestions:

EOFException
FileNotFoundException
ExceptionContentAssist

which are already covered by the IOException above.
Comment 1 David Audel CLA 2007-02-13 09:50:37 EST
This problem is caused by the fact that we use a list of type names to compute proposals and compute type hierarchies would be too costly.

The general case would be hard to fix but perhaps the case of the empty token could be improved.
Comment 2 David Audel CLA 2007-02-15 10:09:57 EST
It's possible to put these proposals lower in the list of proposals but it's currently not possible to not propose them.

As we are unable to know the hierarchy of proposed types then we are unable to know that a type is a subtype of a caught exception.

There is a bug in our 'relevance' algorithm that i will fix and i will enter a bug for the problem that i can't fix.
Comment 3 David Audel CLA 2007-02-15 10:10:19 EST
Created attachment 59060 [details]
Proposed fix
Comment 4 David Audel CLA 2007-02-15 10:11:13 EST
Released for 3.3M6

Test updated
  CompletionTests#testCatchClauseExceptionRef13()

Test added
  CompletionTests#testCatchClauseExceptionRef13b()

I entered bug 174312 for the not fixed part of the problem
Comment 5 David Audel CLA 2007-03-20 08:45:45 EDT
Explanations in my previous comments are not enough precise to describe the released behavior.

When the completion token isn't empty, thrown exceptions are proposed at the top of the list if they are not caught. Thrown exceptions which are caught are filtered. Subclasses of caught exceptions aren't filtered but they are proposed at the bottom of the list (bug 174312). Exceptions which aren't thrown are proposed at the same place in the list (same relevance) as subclasses of caught exceptions.

When the completion token is empty, thrown exceptions are proposed at the top of the list if they are not caught. Thrown exceptions which are caught are filtered. Subclasses of caught exceptions aren't proposed.

Comment 6 Maxime Daniel CLA 2007-03-20 10:13:54 EDT
Verified for 3.3 M6 using build I20070319-1335.

Since the limitations of the implemented solution are documented and the fup
bug 174312 should take care of the additional work that is still needed, I
consider that the situation has improved in the realm of the initial test case
and that this bug is verified.