Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 398022

Summary: Import for generic type of nested class is not always auto created
Product: [Eclipse Project] JDT Reporter: Alexander Karatarakis <alex.karatarakis>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: jarthana
Version: 4.2.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Alexander Karatarakis CLA 2013-01-12 07:55:27 EST
I have the following code:

public final class MyIterator implements Iterator<Entry>
{
	public static final class Entry{}
        //...
}

The import for Entry is not created automatically (with Save actions). Also, if I manually hover over Entry, the correct import is offered in the quick fixes available, but clicking it does nothing.

There are some similar issues regarding imports of static nested class reported (some of them fixed), but this differs in the following: 
If the name of the nested class also exists elsewhere, then the bug occurs. If however the nested class name is unique, there is no problem. So this:

public final class MyIterator implements Iterator<MyEntry>
{
	public static final class MyEntry{}
        //...
}

has no problem auto-adding imports. I used Entry in the first example because there is another Entry in java.util.map, but you can test the bug with any class name occurring anywhere in the workspace, even user-created ones.
Comment 1 Jay Arthanareeswaran CLA 2013-01-21 01:43:39 EST
Reproduced in master.

But I can't tell how soon we can look at this bug.
Comment 2 Eclipse Genie CLA 2019-09-28 19:04:19 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 3 Alexander Karatarakis CLA 2019-11-03 23:23:50 EST
Still an issue in:

Eclipse IDE for Java Developers
Version: 2019-09 R (4.13.0)
Build id: 20190917-1200
OS: Windows 10, v.10.0, x86_64 / win32
Java version: 11.0.1
Comment 4 Jay Arthanareeswaran CLA 2019-11-04 00:09:56 EST
I think this belongs in JDT UI.