| Summary: | Import for generic type of nested class is not always auto created | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Alexander Karatarakis <alex.karatarakis> |
| Component: | UI | Assignee: | 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 | ||
Reproduced in master. But I can't tell how soon we can look at this bug. 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. 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 I think this belongs in JDT UI. |
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.