Bug 321464 - [quick fix] Quick fix for import when using a member class as a generic type base of the outer class does not work
Summary: [quick fix] Quick fix for import when using a member class as a generic type ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 minor with 1 vote (vote)
Target Milestone: 4.22 M2   Edit
Assignee: Jeff Johnston CLA
QA Contact: Jeff Johnston CLA
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-01 16:24 EDT by Tadas CLA
Modified: 2021-10-29 18:28 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tadas CLA 2010-08-01 16:24:29 EDT
Build Identifier: 20100617-1415

package somepack;

public class Outer<T extends StaticInner> {
	public static class StaticInner {
	}
}

With such code, eclipse will notify you about an error: "StaticInner cannot be resolved to a type".

The first proposed quick-fix is "Import 'StaticInner' (somepack.Outer)", however, it does not add the missing import in this situation.

The workaround is to manually add the missing import. HOWEVER, if you (both directly and indirectly) use the "Organize Imports" feature, the needed import(s) will be removed.

Reproducible: Always

Steps to Reproduce:
1. Save the given code as a class.
2. Try to compile, get the error.
3. Try to use quick fix.
(OPTIONAL:)
4. Add the missing import manually.
5. Use "Organize Imports". (or "Save Actions"/"Clean Up"/"Formatter" with that feature enabled.
Comment 1 Olivier Thomann CLA 2010-08-31 19:27:03 EDT
Using I20100824-1210, I can no longer reproduce.
OrganizeImport preserves or add the missing import.
Closing as WORKSFORME.
Please reopen if this doesn't work for you.
Comment 2 Srikanth Sankaran CLA 2010-09-14 00:51:54 EDT
With build I20100909-1700 I could verify that organize
imports does not remove the import erroneously. I think
this is due to the fix for bug 294057.

However, I do see that the quick fix is ineffective as
complained about in comment# 0.

So reopening and passing it to JDT/UI for comment.
Comment 3 Srikanth Sankaran CLA 2010-09-14 00:53:55 EDT
I don't think this has anything to do with code completion.
I think the submitter meant to say quick fix instead, changing
defect title suitably.
Comment 4 Dani Megert CLA 2010-09-14 02:50:04 EDT
For wrong proposal of import quick fix see bug 272536.
Comment 5 Eclipse Genie CLA 2019-06-22 12:12:17 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 6 Felix Pahl CLA 2021-04-01 17:59:10 EDT
I don't understand why this has been marked as WONTFIX. The quick fix still doesn't do anything, and that seems like a bug that should be fixed.
Comment 7 Jeff Johnston CLA 2021-10-20 13:52:58 EDT
I have a fix for this that I will post shortly
Comment 8 Eclipse Genie CLA 2021-10-20 14:07:59 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/186734
Comment 10 Jeff Johnston CLA 2021-10-21 15:15:34 EDT
Released for 4.22 M2
Comment 11 Jeff Johnston CLA 2021-10-29 18:28:25 EDT
Verified for 4.22 M2 using I20211028-1800 build