Bug 297873 - [quick fix] Quick fix offers to call a different parameterized method but it does not help
Summary: [quick fix] Quick fix offers to call a different parameterized method but it ...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
: 352429 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-12-15 12:35 EST by Remy Suen CLA
Modified: 2022-10-15 13:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2009-12-15 12:35:55 EST
Build id: I20091210-1301

1. In a 1.5 project, enter the following code:

List<?> obj = new ArrayList<Object>();
obj.add(0, new Object());

2. The 'add' method will have an error, hit Ctrl+1, it will suggest to 'Change to 'addAll(...)''. Do so.
3. The code is changed. Save. Now there's an error for 'addAll'. :(
4. Hit Ctrl+1, now it's suggesting 'Cast argument 'new Object()' to 'Collection<? extends ?>' and 'Change to 'add(...)''.
5. Try both. Neither of them will get the code to compile. :((
Comment 1 Markus Keller CLA 2010-01-25 11:24:40 EST
There's no free lunch ;-). Quick fix just makes some guesses and then lets you decide whether they could be useful.

In this case, it looks like we should not propose other methods or to cast arguments, but better concentrate on the type of the target variable 'obj' and suggest to turn it into List<Object> or List<? super Object>.
Comment 2 Dani Megert CLA 2011-07-19 06:08:42 EDT
*** Bug 352429 has been marked as a duplicate of this bug. ***
Comment 3 Eclipse Genie CLA 2020-08-23 14:29:13 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Eclipse Genie CLA 2022-10-15 13:05:34 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.