Summary: | [1.5][assist] Code assist propose final classes in methods type parameter extends clause | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Frederic Fusier <frederic_fusier> | ||||||||
Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> | ||||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||||
Severity: | normal | ||||||||||
Priority: | P4 | CC: | david_audel | ||||||||
Version: | 3.1 | ||||||||||
Target Milestone: | 3.5 M6 | ||||||||||
Hardware: | PC | ||||||||||
OS: | Windows XP | ||||||||||
Whiteboard: | |||||||||||
Attachments: |
|
Description
Frederic Fusier
2005-06-10 12:18:24 EDT
i cannot reproduce 1) and currently there is no special support for final classes in codeassist. But that's real bug. final classes should not be proposed. Similar test case found by Frederic: class X extends Str| comment 0 test case 1) was definitely wrong... String is proposed but not on top of the list In fact, I think I typed: public class X<T extends St<|> and didn't see String as the list as a little bit long... (In reply to comment #1) > i cannot reproduce 1) and currently there is no special support for final > classes in codeassist. > But that's real bug. > final classes should not be proposed. Since <T extends SomeFinalClass> is not a null set, but the singleton set SomeFinalClass, it may not be totally wrong to suggest final classes in these cases ? Personally, I think we should NOT propose final classes, but just checking. > Similar test case found by Frederic: > class X extends Str| There is no uncertainty here: we should not propose final classes here. I have a patch for both, that is under test. (In reply to comment #3) > Since <T extends SomeFinalClass> is not a null set, but the singleton set > SomeFinalClass, it may not be totally wrong to suggest final > classes in these cases ? > > Personally, I think we should NOT propose final classes, but just checking. I agree. Even if it is not totally wrong, propose SomeFinalClass is useless. If a user want to use SomeFinalClass he should write class X { void foo(SomeFinalClass p) {} } and not class X<T extends SomeFinalClass> { void foo(T p) {} } Created attachment 126839 [details]
Proposed fix + tests
We don't propose final classes anymore in ''extends'' contexts
(type declarations, typeparameters, wildcards etc).
Created attachment 127156 [details]
Revised patch
Earlier patch had a couple of problems:
- There was a serious bug due to misunderstanding of "expected types".
- The rejection of final classes in extends contexts is handled differently
now - along the lines of rejecting interfaces where classes are expected.
Created attachment 127304 [details]
Revised patch
Improved patch : Moved some computations out of the critical path.
Comment on attachment 127304 [details]
Revised patch
This patch is OK for me
Released for 3.5M6. Verified for 3.5M6 using I20090310-0100. |