| Summary: | [content assist] Code completion adds wrong method proposal if superclass method contains generic varargs argument | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Andre Bargull <andrebargull+eclipse> | ||||
| Component: | Text | Assignee: | Deepak Azad <deepakazad> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | amj87.iitr, deepakazad, samrat.dhillon | ||||
| Version: | 3.8 | ||||||
| Target Milestone: | 3.8 M6 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Seems broken since pre-3.7 times. Will investigate Created attachment 211750 [details]
Proposing a patch for this bug
This proposed fix is to preserve argument type. Eclipse is dropping everything that comes after '<' while comparing arguments.
extension/org/eclipse/jdt/internal/corext/dom/Bindings.java isEqualMethod is dropping stuff that comes after <> for argument comparison. It makes sense to drop the generic arguments but eclipse should preserve stuff that comes after generic arguments; such as an array.
e.g. while comparing arguments Z<?>[] and Z, if everything after < is dropped Z<?>[] and Z will become equal which is not true.
Deepak, can you please take a look at the above patch(which is against JDT/Text) and see if it solves the problem? If so, we can move it to JDT text for a review. Thanks! (In reply to comment #2) > Created attachment 211750 [details] [diff] > Proposing a patch for this bug Looks reasonable. I will take a look. (Have to make sure that other clients are not adversely affected) (In reply to comment #2) > Created attachment 211750 [details] [diff] > Proposing a patch for this bug Thanks for the patch, Samrat! I tweaked the patch a bit and added a few tests. http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=944192f9c11b3675c106e773bfaafdb80fc6851b |
Build Identifier: M20110825-0847 When overriding a method from a superclass which has got a generic varargs argument, code completion adds a wrong method declaration. Expected: - the following method declaration should be added @Override void method(Z<?>... zs) { // TODO Auto-generated method stub super.method(zs); } Actual: - "transient" modifier is added - varargs argument is changed to array - outer class name ("Testcase") is added - the complete method declaration looks like follows transient void method(Testcase.Z<?>[] zs) {}; Environment: - Eclipse 3.7.1 (M20110825-0847) - JDK 7 --- class Testcase { static interface Z<T> {} static class A { void method(Z<?>... zs) {} } static class B extends A { // - type here `method` and then use code completion (ctrl + space) } } --- Reproducible: Always