Community
Participate
Working Groups
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.
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.
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.
Created attachment 59060 [details] Proposed fix
Released for 3.3M6 Test updated CompletionTests#testCatchClauseExceptionRef13() Test added CompletionTests#testCatchClauseExceptionRef13b() I entered bug 174312 for the not fixed part of the problem
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.
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.